identificarea sistemelor laborator 5
DESCRIPTION
identificarea sistemelorTRANSCRIPT
Identificarea Sistemelor Laborator 2JURCA PAUL-BOGDANA.i.A. 3
close all; clc; clear all;
num=[3]; den=[1 9]; H=tf(num,den);
h=0.05; timpf=30; t=0:h:timpf;
zg_alb=-0.5+(0.5+0.5).*rand(length(t),1);u=zg_alb; [Y]=lsim(H,u,t);
figure(1);plot(t,Y);title('Iesirea sistemului la intrare zgomot alb');hleg1 = legend('Y');
Identificarea Sistemelor Laborator 2 JURCA PAUL-BOGDANA.i.A. 3
matrice=zeros(length(zg_alb),length(zg_alb));i=1;j=1;
while i<=length(u) a=zeros(size(zg_alb)); matrice(:,i)=u'; j=length(u);while j>1
a(j)=u(j-1); j=j-1;
end
end u=a; i=i+1;
hpondere=inv(matrice'*matrice)*matrice'*Y;figure(2);plot(t,hpondere);title('Functia pondere cu metoda c.m.m.p neparametrică');hleg1 = legend('hponder');
Identificarea Sistemelor Laborator 2 JURCA PAUL-BOGDANA.i.A. 3
%test1ym=conv(hpondere,abs(sin(t)));figure(3); subplot(211); [Y1]=lsim(H,abs(sin(t)),t); plot(t,ym(1:length(t)),'r',t,Y1);title('Functia pondere cu semnalul sinus si fct pondere_zg su semnalul sin');hleg1 = legend('ym1','ym zg1');subplot(212); e=ym(1:length(t))'-Y1; plot(t,e); title('erorarea'); hleg1 = legend('err');
%test2 ym2=conv(hpondere,square(t)); figure(4);subplot(211); [Y2]=lsim(H,square(t),t); plot(t,ym2(1:length(t)),'r',t,Y2);
Identificarea Sistemelor Laborator 2 JURCA PAUL-BOGDANA.i.A. 3
title('Functia pondere cu semnalul square si fct pondere_zg su semnalulsquare');hleg1 = legend('ym2','ym zg2');subplot(212); e=ym2(1:length(t))'-Y2; plot(t,e); title('eroarea');hleg1 = legend('err');
%test3 u3(1)=1;for i=1:length(t)
if (i<=100)u3(i)=1;
elseif (i>100 && i<=200)u3(i)=-1;
elseif (i>200)u3(i)=2;
endend
Identificarea Sistemelor Laborator 2 JURCA PAUL-BOGDANA.i.A. 3
[Y3]=lsim(H,u3,t);ym3=conv(hpondere,u3); figure(5); subplot(211);plot(t,ym3(1:length(t)),'r',t,Y3);title('Functia pondere cu semnalul square si fct pondere_zg su semnalul square');hleg1 = legend('ym3','ym zg3');subplot(212); e=ym3(1:length(t))'-Y3; plot(t,e); title('eroarea');hleg1 = legend('err');