Use tfest within parallel loop

조회 수: 2 (최근 30일)
Connor Boss
Connor Boss 2017년 8월 7일
댓글: Roman Schlieper 2020년 3월 5일
I am trying to use the function tfest to estimate a transfer function from frequency response data (frd) within a parlor loop. I am running into transparency violation issues within the tfest function and am getting the following error:
Error using tfest (line 94)
Transparency violation error. See Parallel Computing Toolbox documentation about Transparency
To the best of my knowledge the variables I am using are defined correctly as the tfestimate function does not have any transparency issues a few lines earlier in the code.
Thank you for any advice. The relevant code snippet is shown below:
parfor i = 1:128
len = LENGTH(i,k);
Input = reshape(INPUT(i,k,1:len),[len,1]);
exp_data = reshape(OUTPUT(i,k,1:len),[len,1]);
time = reshape(TIME(i,k,1:len),[len,1]);
fs = 50; % Hz
minFreq = 0.1; % The minimum frequency that the fit is performed from
maxFreq = 3.5; % The maximum frequency that the fit is performed to
np = 2; % Force number of poles in the estimated transfer function
iodelay = NaN; % Initialize estimated pure delay in the system
f = linspace(minFreq,maxFreq,1024);
Txy = tfestimate(Input,exp_data,[],[],f,fs);
measSysPhase = (180/pi)*phase(Txy);
measSysMag = mag2db(abs(Txy));
% Estimated transfer function fit to frequency data
TxyData = frd(Txy,2*pi*f);
estSys = tfest(TxyData,np,[],iodelay);
end
  댓글 수: 1
Roman Schlieper
Roman Schlieper 2020년 3월 5일
put tfest into a function

댓글을 달려면 로그인하십시오.

답변 (1개)

Sean de Wolski
Sean de Wolski 2017년 8월 7일
assign the output back to a cell array
estSys{i} = tfest(...)

카테고리

Help CenterFile Exchange에서 Transfer Function Models에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by