Sie sind auf Seite 1von 12

MATLAB Material for Problem Set #7

echo on Problem_4p10d1, % Execute the commands for Problem 4.10-1. n1=[1,-2,50], % Numerator polynomial. n1 = 1 -2 50

rn1=roots(n1), % Check the location of the zeros. rn1 = 1.0000 + 7.0000i 1.0000 - 7.0000i d1=[1,2,50], % Denominator polynomial. d1 = 1 2 50

rd1=roots(d1), % Check the location of the poles. rd1 = -1.0000 + 7.0000i -1.0000 - 7.0000i h1=tf(n1,d1), % Create the transfer function for Problem 4.10-1. Transfer function: s^2 - 2 s + 50 -------------s^2 + 2 s + 50 figure(1) bode(h1), % Sketch the Bode plot for this system. % The magnitude response is at 0 dB for all frequencies. (Checks!) % The phase response changes by 360 degrees and becomes more negative with % increasing frequency. % Matlab started at 360 degrees and ended at zero degrees. % My sketch started at 0 degrees and ended at -360 degrees. % (Thus, the phase responses are consistent.) % The phase curve goes through the mid-point value of its full transition % at a frequency very close to 7 radians/second (as expected). display('End of Problem 4.10-1') End of Problem 4.10-1 % Problem_4p10d2, % Execute the commands for Problem 4.10-2.

n2a=[1,1], % Numerator polynomial. n2a = 1 1

rn2a=roots(n2a), % Check the location of the zeros. rn2a = -1 d2a=[1,2], % Denominator polynomial. d2a = 1 2

rd2a=roots(d2a), % Check the location of the poles. rd2a = -2 h2a=tf(n2a,d2a), % Create the transfer function for Problem 4.10-2(a). Transfer function: s + 1 ----s + 2 figure(2) bode(h2a), % Sketch the Bode plot for Part (a). % The magnitude response goes from -6dB (an absolute magnitude of 0.5) to % 0dB (an absolute magnitude of 1). % The phase response goes from 0 degrees back to 0 degrees with a positive % phase angle experiencing a maximum phase contribution between the zero's % break frequency and the pole's break frequency. % % Part (b) n2b=[1,2], % Numerator polynomial. n2b = 1 2

rn2b=roots(n2b), % Check the location of the zeros. rn2b = -2 d2b=[1,1], % Denominator polynomial.

d2b = 1 1

rd2b=roots(d2b), % Check the location of the poles. rd2b = -1 h2b=tf(n2b,d2b), % Create the transfer function for Problem 4.10-2(b). Transfer function: s + 2 ----s + 1 figure(3) bode(h2b), % Sketch the Bode plot for Part (b). % The magnitude response goes from +6dB (an absolute magnitude of 2) to % 0dB (an absolute magnitude of 1). % The phase response goes from 0 degrees back to 0 degrees with a negative % phase angle experiencing a minimum phase contribution between the pole's % break frequency and the zero's break frequency. display('End of Problem 4.10-2') End of Problem 4.10-2 % Problem_4p10d3, % Execute the commands for Problem 4.10-3. a=0.5, % Define the constant value for the small damping. a = 0.5000 gain_a=(a/10)*sqrt(a*a+20*20), % Gain value. gain_a = 1.0003 n3a=gain_a*[1,0], % Numerator of band-pass filter. n3a = 1.0003 0

d3a=[1,2*a,a*a+10*10], % Denominator polynomial for band-pass filter. d3a = 1.0000 1.0000 100.2500

h3a=tf(n3a,d3a), % Part (a): Transfer function: s --------------s^2 + s + 100.3

Small damping band-pass filter.

figure(4) bode(h3a), % Display the frequency response of this B.P. filter. % Notice how narrow the band-pass region is for this small value of "a". % % Part (b), with a=10.0 (large value of damping). a=10.0, % Define the constant value for the large damping. a = 10 gain_b=(a/10)*sqrt(a*a+20*20), % Gain value. gain_b = 22.3607 n3b=gain_b*[1,0], % Numerator of band-pass filter. n3b = 22.3607 0

d3b=[1,2*a,a*a+10*10], % Denominator polynomial for band-pass filter. d3b = 1 20 200 Large damping band-pass filter.

h3b=tf(n3b,d3b), % Part (b): Transfer function: 22.36 s ---------------s^2 + 20 s + 200

figure(5) bode(h3b), % Display the frequency response of this B.P. filter. % The pass band is not as narrow for this large damping value. display('End of Problem 4.10-3') End of Problem 4.10-3 % Problem_4p10d4, % Execute the commands for Problem 4.10-4. n4=[1,-1], % Numerator polynomial.

n4 = 1 -1

d4=[1,1], % Denominator polynomial. d4 = 1 1

h4=tf(n4,d4), % T.F. of the all-pass filter. Transfer function: s - 1 ----s + 1 figure(6) bode(h4) % Display the all-pass filter's frequency response. %. display('End of Problem 4.10-4') End of Problem 4.10-4 % MP7p7, % Execute the commands for Matlab Problem Set #7, Problem 7. fo=300, % Bandwidth of low-pass filter in Hertz. fo = 300 wo=2*pi*fo, % Bandwidth of low-pass filter in radians/second. wo = 1.8850e+003 n7=wo^4, % Numerator of L.P. filter. n7 = 1.2624e+013 d7=conv([1,2*0.38268*wo,wo*wo],[1,2*0.92388*wo,wo*wo]), % Denominator. d7 = 1.0e+013 * 0.0000 0.0000 0.0000 0.0018 1.2624

h7=tf(n7,d7), % 4th-order, L.P. Butterworth Filter (cut-off of 300 Hz). Transfer function: 1.262e013 ------------------------------------------------------s^4 + 4926 s^3 + 1.213e007 s^2 + 1.75e010 s + 1.262e013 figure(7) bode(h7) % Examine the frequency response of this L.P. filter. % % Four more poles than finite zeros. % Thus, the phase curve should end at 4*(-90)= -360 degrees. % The phase should go through (-360/2)= -180 degrees at approximately % 2,000. % The magnitude should break at about 2,000 radians/second (1,885 rad/sec.) % and have a slope of 4*(-20) = -80 dB/decade. display('End of Matlab Problem Set #7, Problem 7') End of Matlab Problem Set #7, Problem 7 grid diary off

Figure 1 (below):

Bode Diagram 1

Magnitude (dB) Phase (deg)

0.5

-0.5

-1 360 270 180 90 0 10


-1

10

10 Frequency (rad/sec)

10

Figure 2 (below):
Bode Diagram 0 -1
Magnitude (dB) Phase (deg)

-2 -3 -4 -5 -6 20 15 10 5 0 10
-1

10

10 Frequency (rad/sec)

10

Figure 3 (below):

Bode Diagram 6 5
Magnitude (dB) Phase (deg)

4 3 2 1 0 0 -5

-10 -15 -20 10


-1

10

10 Frequency (rad/sec)

10

Figure 4 (below):

Bode Diagram 0

Magnitude (dB) Phase (deg)

-10

-20

-30

-40 90 45 0 -45 -90 10


0

10

10

Frequency (rad/sec)

Figure 5 (below):

Bode Diagram 10 0
Magnitude (dB) Phase (deg)

-10 -20 -30 -40 -50 90 45 0 -45 -90 10


-1

10

10

10

10

Frequency (rad/sec)

Figure 6 (below):

Bode Diagram 1

Magnitude (dB) Phase (deg)

0.5

-0.5

-1 180 135 90 45 0 10
-2

10

-1

10

10

10

Frequency (rad/sec)

Figure 7 (below):

Bode Diagram 50

Magnitude (dB) Phase (deg)

-50

-100

-150 0 -90 -180 -270 -360 10


2

10

10 Frequency (rad/sec)

10

Das könnte Ihnen auch gefallen