Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all
- clear all
- Pop=eye(4)*100;
- up1=0;
- yp1=0;
- yp2=0;
- Teta=[0;0;0;0];
- zadane=[0.7;0.25;1;1];
- a=0.5;
- b=0.25;
- c=1;
- d=1;
- lambda=input('podaj wartosc parametru lambda:\n');
- N=input('podaj ile pomiarow chcesz wykonac (powinno byc wiecej niz 12000):\n');
- v=zeros(4,N);
- j=1:N;
- for i=1:N
- u=rand(1);
- E=(rand(1)-0.5)/1;
- y=a*yp1+b*yp2+c*u+d*up1+E;
- Phi=[yp1;yp2;u;up1];
- Pop=(1/lambda)*(Pop-((((Pop*Phi)*Phi')*Pop)/(lambda+((Phi'*Pop)*Phi))));
- Teta=Teta+Pop*Phi*(y-Phi'*Teta);
- yp2=yp1;
- yp1=y;
- up1=u;
- if i==10000
- a=0.7;
- %q=1000;
- end
- v(:,i)=Teta(:,1);
- end
- for z=1:4
- figure(z);
- plot(j,v(z,:));
- xlabel 'czas'
- title 'odpowiedz ukladu na zmiane parametru a z 0.5 na 0.7'
- legend (strcat('\lambda=', num2str(lambda)));
- if z==1
- ylabel 'a'
- end
- if z==2
- ylabel 'b'
- end
- if z==3
- ylabel 'c'
- end
- if z==4
- ylabel 'd'
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement