[no,mo] - series(nc,mc,n3,m3);
[nz,mz] - feedback(no,mo,2, [.1 2.8]); disp('Gzam(s) ') printsys(nz,mz)
%zadanie 1
clc,elear nl - (2.5 O 1] > m - (3 4.2 2]; disp(’G(s) ') printsys (nl,m)
[zl,bl,wl] • tf2zp(nl,m) [sl,rl,kl] = residue(nl,m)
yz = step(nz,mz,t);
plot(t,yz),axis([O 6 -0.4 1.2]) dc_yz - degain(nz,mz)
n2 - [16 8]; disp('G2(s)') printsys(n2,m)
[z2,b2,w2] ■ tf2zp(n2,m) [s2,r2,k2] a residue(n2,m)
pzmap (nz.fflz)
axis((-5,0,-0.2,0.2])
[zgz,bgz] - tf2zp(nz,mz)
[sgz,rgz,w] - residue(nz.mz);
ulamki_proste - [sgz,bgz]
t ■ [0:0.01:8]; yi = impulse(nl,m,t); ys ■ step(nl,m,t); plot(t,yi,'y',t,ys,1r1)
[nsk,insk] [zgz_sk,bgz_sk] [sgz_sk,rgz_sk,w] ulamki_proste_skr
■ minreal(nz,mz);
= t£2zp(nsk,msk)
» residue(nsk,msk); = (sgz_sk,bgz_3k]
t a [ 0:.01:6] ;
ysz a step(nsz,msz,t);
yr = step(nr,mr,t);
yusz <• step (nusz,musz, t) ;
plot(t,ysz,'y',t,yr,•g•,t,yusz,1r')
axis( [0 6 0 2.51)
[s,b,k] - residue(n2,ml) t - [0:.05:20];
yi = step(nl,ml,t); %prad - odp. na skok yu = step(n2,ml,t); plot(t,yi,’b1,t,yu,'r1) axis'( [0 20 0 1.2] )
desz a degain(nsz,msz) der a degain(nr,mr) deusz a degain(nusz,musz)
[n3 ,m3] - parallel(2, [1 4.5],0.5, [1 0.9]);
[n4,m4] -series([1,-3],[1,2.25],[1,7] . [1,4]);
disp('G3(s)')
printsys(n3,m3)
disp(1G4(s)')
printsys(n4,m4)
dc_i - degain(nl,ml) dc_u a degain(n2,ml)
%zadanie 2
clc,elear
nl - (4 6.5]; ml = (15 4];
el2 a 1,
m2 - (1 2.5];
[nsz,msz] = series(nl,ml,n2,m2); [nr,mr] = parallel(nl,ml,n2,m2); [nuaz,musz] a feedback(nl,ml,n2,m2) ;
disp('Gszer(s)')
printsys(nsz,msz)
disp(’Grow(s)')
printsys(nr,mr)
disp('G ujemne_sprz_zwr (s)')
printsys(nusz,musz)
[s3z,bsz,ksz] = residue(nsz,msz) ;
[sr,br,kr] ■ residue(nr,mr);
[susz,busz,kusz] a residue(nusz, mus z) ;
[slsz,blsz,klsz]
residue(nsz,conv([1,0],msz))
[sir,blr,klr]
residue(nr,conv((1,0],mr)) [slusz,blusz,klusz] •
residue(nusz,conv([1,0],musz))
i
! Rl a 0.5; R2 - 1.5; R3 - 2;
] LI - 0.02; C3 - 1;
•
%ROZWIAZANIB SYMBOLICZNE Z KARTKI PAPIERU
I
I %TRANSMITANCJA PRĄDOWĄ: U(s) --> I(s0 ! nl - (L1*C3 R1*C3 0];
ml - [(R1+R2+R3)*L1*C3 (R2+R3)*R1*C3 + L1 Rl] ;
%TRANSMITANCJA ZASTĘPCZA: U(s) --> Y(s)
; n2 . [R3*L1*C3 Rl*R3*C3+L1 Rl];
disp('Gi(s)•) printsys(nl,ml) disp(1Gu(s)1) printsys(a2,ml)
ta - (0:0.1:75]; r * length(ts); u - zeros(1,r);
for k a l:r,
if t3(k)<25, u(k) - 1;
elseif ts(k)>-25 & ta(k)<50,
u(k) - 2;
else
u(k) - -.5;
end
end ys a lsim(n2,ml,u,ts) ;
plot(ts,ys),axis([0 75 -0.7 2.2])