0% found this document useful (0 votes)
35 views2 pages

Matlab Lab 22 10

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Matlab Lab 22 10

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Dr.

Nalin Kumar Sharma


Control Systems Control Systems Lab 22-10-2024
1. Consider the following systems with closed-loop transfer functions
4
(a) s(1+0.5s)(1+0.08s)
200(s+1)
(b) (s+10)2
200(s+2)
(c) s(s2 +10s+100)

(a) Plot their Bode-plot using MATLAB.


(b) Find their Gain Margin, Phase Margin, Gain Crossover Frequency, Phase
Crossover Frequency

2. The response of a second-order system can be characterized by its damping ra-


tio (ζ), which significantly affects the system’s stability and performance. The
Bode plot provides a graphical representation of the system’s frequency response,
including magnitude and phase information.
In this analysis, we will consider a standard second-order transfer function given
by:

ωn2
G(s) = (1)
s2 + 2ζωn s + ωn2
where ωn is the natural frequency, and ζ is the damping ratio.
We will plot the Bode plot for different values of the damping ratio (ζ = 0, 0.2, 0.4, 0.6, 0.8, 1)
to observe how it influences the system’s response.
The following MATLAB code generates the Bode plot for the specified damping
ratios:
1 % Define the natural frequency ( omega_n )
2 omega_n = 1; % Natural frequency ( rad / s )
3

4 % Define the damping ratios to be analyzed


5 zeta_values = [0 , 0.2 , 0.4 , 0.6 , 0.8 , 1];
6
7 % Create a figure for the Bode plots
8 figure ;
9

10 % Loop through each damping ratio and plot the Bode plot
11 for zeta = zeta_values
12 % Define the transfer function for the second - order system
13 num = omega_n ^2; % Numerator ( omega_n ^2)
14 den = [1 , 2* zeta * omega_n , omega_n ^2]; % Denominator ( s ^2 + 2*
zeta * omega_n * s + omega_n ^2)
15
16 % Create the transfer function
17 sys = tf ( num , den ) ;
18

1
Dr. Nalin Kumar Sharma
Control Systems Control Systems Lab 22-10-2024
19 % Plot the Bode plot for the current damping ratio
20 [ mag , phase , w ] = bode ( sys ) ;
21 mag = squeeze ( mag ) ; % Squeeze to remove singleton dimensions
22 phase = squeeze ( phase ) ;
23
24 % Plot magnitude
25 subplot (2 , 1 , 1) ; % Magnitude plot in the first subplot
26 semilogx (w , 20* log10 ( mag ) ) ; % Convert to dB
27 hold on ;
28
29 % Plot phase
30 subplot (2 , 1 , 2) ; % Phase plot in the second subplot
31 semilogx (w , phase ) ;
32 hold on ;
33 end
34
35 % Customize the magnitude plot
36 subplot (2 , 1 , 1) ;
37 title ( ’ Bode_Plot_of_Second - O r d e r _ S y s t e m _ w i t h _ V a r y i n g _ \ zeta ’) ;
38 xlabel ( ’ Frequency ( rad / s ) ’) ;
39 ylabel ( ’ Magnitude ( dB ) ’) ;
40 legend ( arrayfun ( @ ( z ) sprintf ( ’ \\ zeta =%.1 f ’ , z ) , zeta_values , ’
UniformOutput ’ , false ) ) ;
41 grid on ;
42
43 % Customize the phase plot
44 subplot (2 , 1 , 2) ;
45 xlabel ( ’ Frequency ( rad / s ) ’) ;
46 ylabel ( ’ Phase ( degrees ) ’) ;
47 legend ( arrayfun ( @ ( z ) sprintf ( ’ \\ zeta ␣ = ␣ %.1 f ’ , z ) , zeta_values , ’
UniformOutput ’ , false ) ) ;
48 grid on ;
49

50 % Adjust the figure layout


51 sgtitle ( ’ B o d e _ P l o t s _ f o r _ D i f f e r e n t _ D a m p i n g _ R a t i o s ’) ;

You might also like