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 view (last 30 days)
Show older comments
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 Comments
Edric Ellis
on 22 Oct 2014
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.
Answers (0)
See Also
Categories
Find more on Filter Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!