Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %------------------------------------- 1. feladat -----------------------------------------------
- s=tf('s');
- display('<<< Continuous-time process: >>>')
- P=zpk(1/(1+5*s)/(1+10*s))
- Ts=1;
- display('<<< Discretized process with Ts=1 sec: >>>')
- G=zpk(c2d(P,Ts))
- z=tf('z',Ts);
- display('<<< Decompose and normalize as G(z)=Gm(z)Gp(z) with Gm(1)=1: >>>')
- pause;
- display('<<< Gm(z): >>>')
- Gm=1
- display('<<< Gp(z): >>>')
- Gp=G
- display('<<< Specify the design polynomial Rr(z)=Rn(z)=1/z: >>>')
- pause;
- Rr=1/z;
- Rn=1/z
- display('<<< Calculate the C(z) controller: >>>')
- pause;
- C=minreal(Rn/Gp/(1-Rn*Gm),0.0001)
- display('<<< Find the loop transfer function L(z)=C(z)G(c): >>>')
- pause;
- L=minreal(C*G,0.0001)
- display('<<< Show the transfer function T(z)=Y(z)/Yr(z) : >>>')
- pause;
- T=minreal(L/(1+L),0.0001)
- display('<<< The transfer function form reflects the numerical conditions): >>>')
- pause;
- T=tf(T)
- display('<<< Compare with the theoretical value (Gm/z): >>>')
- pause;
- tf(Gm/z)
- display('<<< Show the servo input-output records: >>>')
- pause;
- y=step(T,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
- u=step(minreal(C/(1+L)),10); subplot(212),stairs(t,u),grid;
- pause;
- display('<<< Check the disturbance rejecion: >>>')
- pause;
- S=minreal(1/(1+L))
- tf(S)
- display('<<< Compare with the theoretical value (1-Rn/Gm): >>>')
- pause;
- tf(1-Rn*Gm)
- display('<<< Show the disturbance rejecion input-output records: >>>')
- pause;
- y=step(S,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
- u=step(minreal(-C/(1+L)),10); subplot(212),stairs(t,u),grid;
- display('<<< Check the steady-state properties: >>>')
- dcgain(T)
- dcgain(S)
- pause;
- display('<<< Decompose G(z) with Gm=(z+0.9048)/(1+0.9048): >>>')
- Gm=(z+0.9048)/(1+0.9048)/z
- display('<<< Gp(z): >>>')
- Gp=minreal(G/Gm,0.0001)
- display('<<< Calculate the C(z) controller: >>>')
- pause;
- C=minreal(Rn/Gp/(1-Rn*Gm),0.0001)
- display('<<< Find the loop transfer function L(z)=C(z)G(c): >>>')
- pause;
- L=minreal(C*G,0.0001)
- display('<<< Show the transfer function T(z)=Y(z)/Yr(z) : >>>')
- pause;
- T=minreal(L/(1+L),0.0001)
- display('<<< The transfer function form reflects the numerical conditions): >>>')
- pause;
- T=tf(T)
- display('<<< Compare with the theoretical value (Gm/z): >>>')
- pause;
- tf(Gm/z)
- display('<<< Show the servo input-output records: >>>')
- pause;
- y=step(T,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
- u=step(minreal(C/(1+L)),10); subplot(212),stairs(t,u),grid;
- pause;
- display('<<< Check the disturbance rejecion: >>>')
- pause;
- S=minreal(1/(1+L))
- tf(S)
- display('<<< Compare with the theoretical value (1-Rn/Gm): >>>')
- pause;
- tf(1-Rn*Gm)
- display('<<< Show the disturbance rejecion input-output records: >>>')
- pause;
- y=step(S,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
- u=step(minreal(-C/(1+L)),10); subplot(212),stairs(t,u),grid;
- %------------------------------------- 2. feladat -----------------------------------------------
- s=tf('s');
- display('<<< Continuous-time process: >>>')
- P=zpk(1/(1+5*s)/(1+8*s)/(1+10*s))
- Ts=1;
- display('<<< Discretized process with Ts=1 sec: >>>')
- G=zpk(c2d(P,Ts))
- z=tf('z',Ts);
- display('<<< Decompose and normalize as G(z)=Gm(z)Gp(z) with Gm(1)=(z+3.358)/(1+3.358)/z: >>>')
- pause;
- display('<<< Gm(z): >>>')
- Gm=(z+3.358)/(1+3.358)/z
- display('<<< Gp(z): >>>')
- Gp=minreal(G/Gm,0.0001)
- display('<<< Specify the design polynomial Rn(z)=1/z: >>>')
- pause;
- Rn=1/z
- display('<<< Calculate the C(z) controller: >>>')
- pause;
- C=minreal(Rn/Gp/(1-Rn*Gm),0.0001)
- display('<<< Find the loop transfer function L(z)=C(z)G(c): >>>')
- pause;
- L=minreal(C*G,0.0001)
- display('<<< Show the transfer function T(z)=Y(z)/Yr(z) : >>>')
- pause;
- T=minreal(L/(1+L),0.0001)
- display('<<< The transfer function form reflects the numerical conditions): >>>')
- pause;
- T=tf(T)
- display('<<< Compare with the theoretical value (Gm/z): >>>')
- pause;
- tf(Gm/z)
- display('<<< Show the servo input-output records: >>>')
- pause;
- y=step(T,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
- u=step(minreal(C/(1+L)),10); subplot(212),stairs(t,u),grid;
- display('<<< Check the disturbance rejecion: >>>')
- pause;
- S=minreal(1/(1+L))
- tf(S)
- display('<<< Compare with the theoretical value (1-Rn/Gm): >>>')
- pause;
- tf(1-Rn*Gm)
- display('<<< Show the disturbance rejecion input-output records: >>>')
- pause;
- y=step(S,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
- u=step(minreal(-C/(1+L)),10); subplot(212),stairs(t,u),grid;
- display('<<< Check the steady-state properties: >>>')
- dcgain(T)
- dcgain(S)
- pause;
- display('<<< Define new Rn=Rr=0.1/(z-0.9) >>>');
- Rn=0.1/(z-0.9)
- Rr=0.1/(z-0.9)
- display('<<< Calculate the C(z) controller: >>>')
- pause;
- C=minreal(Rn/Gp/(1-Rn*Gm),0.0001)
- display('<<< Find the loop transfer function L(z)=C(z)G(c): >>>')
- pause;
- L=minreal(C*G,0.0001)
- display('<<< Show the transfer function T(z)=Y(z)/Yr(z) : >>>')
- pause;
- T=minreal(L/(1+L),0.0001)
- display('<<< The transfer function form reflects the numerical conditions): >>>')
- pause;
- T=tf(T)
- display('<<< Compare with the theoretical value (Gm/z): >>>')
- pause;
- tf(Rr*Gm/z)
- display('<<< Show the servo input-output records: >>>')
- pause;
- y=step(T,30); t=0:30; subplot(211),plot(t,y,'*'),grid;
- u=step(minreal(C/(1+L)),30); subplot(212),stairs(t,u),grid;
- pause;
- display('<<< Check the disturbance rejecion: >>>')
- pause;
- S=minreal(1/(1+L))
- tf(S)
- display('<<< Compare with the theoretical value (1-Rn/Gm): >>>')
- pause;
- tf(1-Rn*Gm)
- display('<<< Show the disturbance rejecion input-output records: >>>')
- pause;
- y=step(S,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
- u=step(minreal(-C/(1+L)),10); subplot(212),stairs(t,u),grid;
- pause;
- display('<<< Check the steady-state properties: >>>')
- dcgain(Rr*Gm/z)
- dcgain(S)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement