System ID function AR or ARMAX
Show older comments
Hello,
I am trying to fit a sum of two exponentials with time-domain data using system identification toolbox functions ar or armax. It appears that the fitting quality is not good and it's not my expectation. I attach my simple code below. I wonder if I made any simple mistakes. Any idea would be welcome. Thanks!
% generate data: sum of 2 exp
N = 1000;
x = (0:(N-1))';
y0 = exp(-0.01*x)+0.8*exp(-0.1*x); % positive sum of two decaying exp
y = y0+0.01*max(y0)*randn(N,1); % add a bit of noise
% apply SYSID tools: ar or armax
n = 2;
yid = iddata(y,[],1);
%sys = ar(yid,n);
sys = armax(yid,[n 0]);
[yh, FIT, x0] = compare(yid,sys);
% show results
figure(1);
clf;
plot(x,y,x,yh.y,'LineWidth',4);
legend('data','SYSID');
disp('system poles');
disp(roots(sys.a));
Kin
Accepted Answer
More Answers (0)
Categories
Find more on Data Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!