confused by "predict" fuction!

1 Ansicht (letzte 30 Tage)
E U
E U am 12 Sep. 2014
Bearbeitet: E U am 12 Sep. 2014
Here is the link for explaining the difference between k-step ahead prediction and simulation performance of a linear model:
I have the following code:
-----------------------------------
u=[10; -20; 50; 70; 30; 90; 0; 120; -60; 40; 80; 40; -60; 10; 130];
t=[1:length(u)]';
y_meas_0 = 80; % y0 for real system
y_mod_0 = 100; % y0 for approximate model of real system
y_meas(1)=y_meas_0;
y_mod(1)=y_mod_0;
for k=1:length(u)
y_meas(k+1,1)=0.95*y_meas(k)+1.45*u(k)+sin(k); % real system response
y_mod(k+1,1)= 0.9*y_mod(k)+1.5*u(k); % model response
end
%M = idss(A,B,C,D,K,X0,Ts)
sys_mod=idss(0.9, 1.5, 1, 0, 0, y_mod_0, 1);
z_meas=iddata(y_meas(1:length(u)), u, 1); % measured input-output data
opt = predictOptions('InitialCondition', y_mod_0);
[y_pr, x0e, sys_pred]=predict(sys_mod, z_meas, 1, opt); % 1-step prediction
y_sim=lsim(sys_mod,u,t, y_mod_0); % simulating model
comp=[y_meas(1:length(u)) y_pr.y y_sim(1:length(u))] % comparing results
-----------------------------------
However, I see that the predicted outputs are the same results as simulated outputs. This is opposite to the explanation made in the above link. I am confused. I will be happy for expert comments.

Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by