I'm aware that I have switched round the input and output data in the example above. Using them the correct way round still gives an error of about 10^-7.
Different answer using Box-Jenkins identification inside parfor loop
1 次查看(过去 30 天)
显示 更早的评论
I am using the Box-Jenkins method in the System Identification toolbox to identify a system from some experimental data, and am looping over several different i/o delays to find which gives the smallest RMS modelling error. I want to use a parfor loop for speed, however this is giving me an inaccurate answer. The following code reproduces my error:
clear;
load iddemo_heatexchanger_data
Data = iddata(ct,pt,Ts);
nb = 5;
nf = 5;
nc = 5;
nd = 5;
nk = 10;
anspar = 0;
parfor i = 1:1
BJModel = bj(Data,[nb nc nd nf nk],'focus','simulation');
ct_BJ = lsim(BJModel,pt,t);
anspar(i) = rms(ct-ct_BJ);
end
ansfor = 0;
for i = 1:1
BJModel = bj(Data,[nb nc nd nf nk],'focus','simulation');
ct_BJ = lsim(BJModel,pt,t);
ansfor(i) = rms(ct-ct_BJ);
end
BJModel = bj(Data,[nb nc nd nf nk],'focus','simulation');
ct_BJ = lsim(BJModel,pt,t);
ansnoloop = rms(ct-ct_BJ);
This gives me 1.3126 for ansfor and ansnoloop, but 1.3123 for anspar. The disparity between the parfor loop answer and the for loop/no loop answers is even larger with the data set I am using. Any ideas what might be causing this?
3 个评论
Edric Ellis
2014-10-22
One difference that may be relevant is that parallel pool workers run in single computational thread mode. Try launching your MATLAB client using the -singleCompThread command-line option and comparing the results.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!