confused by "predict" fuction!
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!