grid on;
[mag,phase,w]=bode(sys,w); [Mp,k]=max(mag);
resonant_peak=20*log10(Mp) resonant_fre=w(k)
n=1;while 20*log10(mag(n))>-3;n=n+1;end; bandwidth=w(n)
输出:
Transfer function: 1 --------------------- 0.5 s^3 + 1.5 s^2 + s
Transfer function: 1 ------------------------- 0.5 s^3 + 1.5 s^2 + s + 1
resonant_peak =
5.2388
resonant_fre =
0.7906
bandwidth =
1.2649
Bode Diagram20Magnitude (dB)Phase (deg)0-20-40-600-90-180-27010-1100101Frequency (rad/sec)
3.1A
源程序:
num = [1 2 3]; den = [1 3 3 1]; [A,B,C,D] = tf2ss(num,den)
输出:
A =
-3 -3 -1
1 0 0 0 1 0 B =
1 0 0 C =
1 2 3 D =
0 3.2B
源程序:
Z=[-1 -3]; P=[0 -2 -4 -6]; K=4;
[A,B,C,D]=zp2ss(Z,P,K)
输出:
A =
-10.0000 -4.8990 0 4.8990 0 0 -6.0000 -4.2866 -2.0000 0 0 1.0000 B =
1 0 1 0
0 0 0 0 C =
0 0 0 4 D =
0 3.1C
源程序:
A=[0 1;1 -2]; B=[0;1]; C=[1 3]; D=1;
[num,den]=ss2tf(A,B,C,D); tf(num,den)
[z,p,k]=ss2zp(A,B,C,D); zpk(z,p,k)
输出:
Transfer function: s^2 + 5 s ------------- s^2 + 2 s - 1
Zero/pole/gain: s (s+5) -------------------- (s+2.414) (s-0.4142)
源程序:
A1=[0 1;-1 -2]; B1=[0;1];
C1=[1 3];D1=[1]; A2=[0 1;-1 -3];
B2=[0;1];
C2=[1 4];D2=[0];
[A,B,C,D]=series(A1,B1,C1,D1,A2,B2,C2,D2) [A,B,C,D]=parallel (A1,B1,C1,D1,A2,B2,C2,D2) [A,B,C,D]=feedback (A1,B1,C1,D1,A2,B2,C2,D2) [A,B,C,D]=feedback (A1,B1,C1,D1,A2,B2,C2,D2,+1)
输出:
串联连接 A =
0 1 -1 -3 0 0 0 0 B =
0 1 0 1 C =
1 4 D =
0
并联连接 A =
0 1 -1 -2 0 0 0 0
0 0 1 3 0 1 -1 -2 0 0 0 0 0 0 0 1 -1 -3