PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Fourier and Laplace 341


MATLAB Solution
% Script file: nyquist _ bode
Y=[1 5]; X=[1 3 4 5];
[real _ H, imag _ H,w1] = nyquist(Y,X);
[mag, phase,w2] = bode(Y,X);
disp(‘^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^’)
disp(‘ Bode default points ‘)
disp(‘ w mag [H(w)] angle [H(w)] ‘)
disp(‘^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^’)
[w2 mag phase]
disp(‘***********************************’)
disp(‘^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^’)
disp(‘ Nyquist default points ‘)
disp(‘ w real [H(w)] imag [H(w)] ‘)
disp(‘^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^’)
[w1 real_H imag_H]
disp(‘***********************************’)

figure(1) % nyquist plots
w=-1:0.4:10;
subplot(1,2,1)
nyquist(Y,X,w)
subplot(1,2,2)
nyquist(Y,X)

figure(2)
ww=0.1:0.1:5; % bode plots
subplot(1,2,1)
bode(Y,X,ww)
subplot(1,2,2)
bode(Y,X)
The script fi le nyquist_bode is executed and the results are indicated as follows:
>> nyquist _ bode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bode default points
w mag[H(w)] angle[H(w)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ans =
0.1000 1.0030 -3.4442
0.1184 1.0042 -4.0793
0.1401 1.0059 -4.8330
0.1658 1.0083 -5.7285
......................................................
1.4810 1.6782 -104.0615
1.5850 1.5145 -119.4969
1.7139 1.2510 -135.5458
......................................................
60.3237 0.0003 -181.8893
71.3935 0.0002 -181.5988
84.4947 0.0001 -181.3524
100.0000 0.0001 -181.1436
***********************************
Free download pdf