필터 지우기
필터 지우기

What should be the termination criteria for closed loop system identification with lsqlin?

조회 수: 1 (최근 30일)
Closed loop system identification of a model is done through optimization of parameters. lsqlin is used for the optimization process. The system identification process is to terminate after satisfying a predefined criterion. The criterion has here has been that the error should be less than 0.1. By the system identification process, the error decreases during each iteration until 6th iteration in my problem. Starting from 7th iteration the error value keeps increasing. Why does this happen? I thought if the error cannot decrease further the error should stagnate. But that does not happen. Is my termination criterion correct? Is it something to do with the solver? Find below my code and output until 7th iteration.
clc; clear all; close all;
global d2y_dt2e
g=9.81;
d2y_dt2e = g*[0.074 0.008 -0.106 -0.09 -0.09 -0.106 -0.123 -0.123 -0.123 -0.09 -0.09 -0.335 -0.302 -0.498 -0.762 -1.233 -1.688 -1.941 -1.946 -1.694 -1.284 -1.127 -0.899 -0.895 -1.127 -1.446 -1.786 -2.519 -3.339 -4.437 -5.359 -6.295 -6.75 -6.963 -7.211 -7.56 -7.788 -8.472 -8.841 -9.504 -10.208 -11.093 -12.217 -13.912 -16.064 -18.44 -20.817 -22.714 -24.48 -25.156 -25.2 -25.004 -24.72 -24.72 -25.375 -26.683 -28.275 -29.954 -31.197 -32.352 -33.028 -33.573 -33.879 -34.01 -33.923 -33.879 -33.858 -33.836 -34.185 -34.294 -34.643 -34.665 -34.665 -34.578 -34.338 -34.077 -34.011 -34.404 -35.08 -35.909 -36.279 -36.083 -35.582 -34.797 -33.947 -33.206 -32.661 -31.963 -31.309 -30.481 -29.369 -28.105 -26.709 -25.38 -23.788 -22.567 -21.412 -20.605 -19.864 -19.123 -18.513 -17.902 -17.074 -16.158 -15.112 -14.022 -13.063 -11.863 -10.795 -9.749 -8.899 -8.092 -7.307 -6.522 -5.607 -4.975 -4.277 -3.928 -3.732 -3.514 -3.318 -3.122 -2.904 -2.555 -2.294 -1.902 -1.575 -1.27 -0.921 -0.703 -0.485 -0.311 -0.071 -0.028 0.081 0.081 0.059 0.103 0.321 0.408 0.517 0.713 0.887 0.887 0.865 0.909 0.887 0.712 0.712 0.712];
%%System Identification
% Initial guess
c11=0;k11=2.4*10^5;
P1 = SysIdenFunc(c11,k11);
function [ P1 ] = SysIdenFunc( c11,k11)
global d2y_dt2e
s=0.001;Te=150;m1=76;Tp=120;Vv=15.646; Av=pi*Vv/(2*Tp*s); Cv=pi/(Tp*s); tspan=0:s:Te*s;g=9.81;
err=1;i=0
while err >.1
i=i+1;
dy_dt= @(t,y) [y(2); (-c11*y(2)-k11*y(1))/m1+Av*sin(Cv*t)];
[~, z]=ode45(@(t,y) dy_dt(t,y),0:s:Tp*s,[0 0]);
dy_dt= @(t,y) [y(2); (-c11*y(2)-k11*y(1))/m1];
[~, w]=ode45(@(t,y) dy_dt(t,y),Tp*s+s:s:Te*s,[z(end,1) z(end,2)]);
y=vertcat(z(:,1),w(:,1));dy_dt=vertcat(z(:,2),w(:,2));d2y_dt2=vertcat((-c11*z(:,2)-k11*z(:,1))/m1,(-c11*w(:,2)-k11*w(:,1))/m1);
A= [-dy_dt/m1 -y/m1];
B=[-1 0 ; 0 -1];
C=[0 0];
P1=lsqlin(A(1:length(tspan),1:2),[0 d2y_dt2e].',B,C,[],[],[],[],[],optimset('LargeScale','off','Display','off','MaxFunEvals', 400000,'MaxIter',40000))
accl=(-P1(1)*dy_dt-P1(2)*y)/m1;
plot(tspan,accl/g,tspan,[0 d2y_dt2e/g])
err=rms((accl(1:Te+1)-[0 d2y_dt2e].')./mean(abs(d2y_dt2e.')))
c11=P1(1);k11=P1(2);
end
end
Output:
i = 1;
err = 0.5979;
i = 2;
err = 0.5785;
i = 3;
err = 0.5592;
i = 4;
err = 0.4820;
i = 5;
err = 0.3848;
i = 6;
err = 0.3371;
i = 7;
err = 0.3416;
Any help is greatly appreciated.
  댓글 수: 1
Swarooph
Swarooph 2016년 10월 18일
I don't have an answer but I've got 2 questions which might help you.
  1. Does your routine hit the termination criterion? If not, when and why does it terminate?
  2. Have you tried to validate your model with a separate data set and calculate the error for that? Do you think your model might be suffering from overfitting? I am referring to an example like this where your error initially goes down, but then actually overfits the data and starts increasing in error.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Nonlinear ARX Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by