Professional Documents
Culture Documents
Aim:
To create transfer function and plot its Nyquist response, Bode Plot, Root Locus and Step Response
in MATLAB.
Objective:
To create transfer function and plot its Nyquist response, Bode Plot, Root Locus and Step Response.
Theory:
Create the following transfer function
The Nyquist function can display a grid of M-circles, which are the contours of constant closed-loop
magnitude. M-circles are defined as the locus of complex numbers where the following quantity is a
constant value across frequency.
T(jw) = (|G(jw))/(|1+G(jw)|)
Here, ω is the frequency in radians/Time Unit, where Time Unit is the system time units, and G is the
collection of complex numbers that satisfy the constant magnitude requirement. To display the grid
of M-circles, right-click in the plot and select Grid. Alternatively, use the grid command
clc
nyquist (GH)
disp (Gm)
disp (Pm)
disp (Wcp)
disp (Wcg)
grid on;
Compare the frequency response of several systems on the same Nyquist plot.
Simulation Result
disp (Gm1)
disp (Pm1)
disp ('Phase crossover frequency for system1 is')
disp (Wcp1)
disp (Wcg1)
grid on;
disp (Gm2)
disp (Pm2)
disp (Wcp2)
disp (Wcg2)
grid on;
disp (Gm3)
disp (Pm3)
disp (Wcp3)
disp (Wcg3)
grid on;
SIMULATION RESULTS:
MATLAB CODE FOR BODE PLOT
clear all
clc
options = bodeoptions;
figure (1)
bode (GH,options); % refer to the Matlab help page on bodeoptions for more details … and optional
parameters.
grid
Simulations Results
MATLAB CODE FOR BODE PLOT to access frequency response data directly
clear all
clc
s = tf('s');
G = 1/(s+1);
[mag,phase,wout] = bode(G,win);
grid on
size(wout) % wout is the output frequencies at which the response was evaluated
size(mag) % mag is the magnitude in absolute units (i.e., not in dB), phase is the phase in %degrees
size(phase)
clc
GH = tf ([0 2 5], [1 2 3]);
rlocus(GH)
grid on
Zeta = 0.7;
Wn = 1.8;
sgrid(Zeta, Wn)
Simulation Results
clc
num = [0 2 5];
denom = [1 2 3];
GH = tf (num, denom);
step (GH)
R = roots(denom)
ltiview (GH)
Simulation Results
We have discussed the MATLAB Codes for all the above mentioned Plots.