### Gitlab Runner Update from lnsi-auxfiles/master:Update .gitlab-ci.yml

parent eb447dfb
 % Exercise 7.5 :: Least Squares Identification % % TUHH :: Institut for Control Systems :: Control Systems Theory and Design % Last update: 23.01.2009 clear all clc load cs7_LSsysdat Ts = 1; % sampling time n = 3; % model order M = mkm(y3,u3,n); yn = y3(n+1:length(y3)); % FIXME p = pinv(M'*M)*M'*yn; % get parameters % FIXME den = [1 p(1:n)']; % FIXME num = p(n+1:2*n)'; % FIXME G = tf(num,den,Ts); [p z] =pzmap(G); %% Plot simulation results of this model with the other signals Tfin = length(u3)-1; T = (0:Ts:Tfin)'; figure(1) % step [y,T,x]=lsim(G,u1,T); subplot(211), plot(T,[y y1]), title('step input : true plant and model'), legend('model','plant') subplot(212), plot(T,y-y1), title('step input : error between true plant and Model') figure(2) % sin [y,T,x]=lsim(G,u2,T); subplot(211), plot(T,[y y2]), title('sinusoidal input : true plant and model'), legend('model','plant') subplot(212), plot(T,y-y2), title('sinusoidal input : error between true plant and Model ') figure(3) % white noise [y,T,x]=lsim(G,u3,T); subplot(211), plot(T,[y y3]), title('white noise input : true plant und Model'), legend('model','plant') subplot(212), plot(T,y-y3), title('white noise input : error between true plant and model')
 % Exercise 7.5 :: Least Squares Identification - inverses % % TUHH :: Institut for Control Systems :: Control Systems Theory and Design % Last update: 23.01.2009 clear all clc format short e load cs7_LSsysdat for i=1:10 M = mkm(y2,u2,i); svd(M'*M) end for i=1:20 M = mkm(y3,u3,i); svd(M'*M) end
 function M = mkm(y,u,n) % M = mkm(y,u,n) % Form the measurement matrix M % y - measured outputs % u - measured inputs % n - order of the system ny = length(y); nu = length(u); ndata = min(nu,ny)-1; for i=n:ndata M(i-n+1,1:n) = -y(i:-1:i-n+1)'; M(i-n+1,n+1:2*n) = u(i:-1:i-n+1)'; end