BODE PLOT FROM A TRANSFER FUNCTION
THEORY:
Bode computes the magnitude and phase of the frequency response of LTI models. When
invoked without left-side arguments, bode produces a Bode plot on the screen. The magnitude is
plotted in decibels (dB), and the phase in degrees. The decibel calculation for mag is computed
as 20log10(|H(jw)|), where H(jw) is the system's frequency response. Bode plots are used to
analyze system properties such as the gain margin, phase margin, DC gain, bandwidth,
disturbance rejection, and stability.
Bode Calculations Gain
The magnitude of the transfer function T is defined as:
However, it is frequently difficult to transition a function that is in "numerator/denominator"
form to "real+imaginary" form. Luckily, our decibel calculation comes in handy. Let's say we
have a frequency response defined as a fraction with numerator and denominator polynomials
defined as:
If we convert both sides to decibels, the logarithms from the decibel calculations convert
multiplication of the arguments into additions, and the divisions into subtractions:
Gain = ∑ 20log(jω + zn) − ∑ 20log(jω + pm)
n m
Submit this document with MATLAB solutions, m-file (print) and short
discussion.
30
bode(sys) plots the Bode response of an arbitrary LTI model sys. This model can be continuous
or discrete, and SISO or MIMO. In the MIMO case, bode produces an array of Bode plots, each
plot showing the Bode response of one particular I/O channel. The frequency range is
determined automatically based on the system poles and zeros.
bode(sys,w) explicitly specifies the frequency range or frequency points to be used for the plot.
To focus on a particular frequency interval [wmin,wmax], set w = {wmin,wmax}. To use
particular frequency points, set w to the vector of desired frequencies. Use logspace to generate
logarithmically spaced frequency vectors. All frequencies should be specified in radians/sec.
bode(sys1,sys2,...,sysN) or bode(sys1,sys2,...,sysN,w) plots the Bode responses of several LTI
models on a single figure. All systems must have the same number of inputs and outputs, but
may otherwise be a mix of continuous and discrete systems. This syntax is useful to compare the
Bode responses of multiple systems.
bode(sys1,'PlotStyle1',...,sysN,'PlotStyleN') specifies which color, linestyle, and/or marker
should be used to plot each system. For example,
bode(sys1,'r--',sys2,'gx')
uses red dashed lines for the first system sys1 and green 'x' markers for the second system sys2.
When invoked with left-side arguments
[mag,phase,w] = bode(sys)
[mag,phase] = bode(sys,w)
return the magnitude and phase (in degrees) of the frequency response at the frequencies w (in
rad/sec). The outputs mag and phase are 3-D arrays with the frequency as the last dimension (see
"Arguments" below for details). You can convert the magnitude to decibels by
magdb = 20*log10(mag)
MATLAB PROGRAM:
num=input('enter the numerator of the transfer function')
den=input('enter the denominator of the transfer function')
h=tf(num,den)
[gm pm wcp wcg]=margin(h)
bode(h)
31
PROCEDURE:
• Write the MATLAB program in the MATLAB editor.
• Then save and run the program.
• Give the required inputs.
• The syntax "bode(h)" solves the given input transfer function and gives the bode plot,
• where num,den are the numerator and denominator of the transfer function.
• Now plot the bode plot theoretically for the given transfer function and compare it with the
plot obtained practically.