Theory
A Bode plot is a graph of the transfer function of a linear, time-invariant system versus frequency, plotted with a log-frequency axis, to show the system's frequency response. It is usually a combination of a Bode magnitude plot, expressing the magnitude of the frequency response gain and a Bode phase plot, expressing the frequency response phase shift.
The magnitude axis of the Bode plot is usually expressed as decibels of power, that is by the 20 log rule: 20 times the common (base 10) logarithm of the amplitude gain. With the magnitude gain being logarithmic, Bode plots make multiplication of magnitudes a simple matter of adding distances on the graph (in decibels).
log(a.b)= log(a)+log(b)
A Bode phase plot is a graph of phase versus frequency, also plotted on a log-frequency axis, usually used in conjunction with the magnitude plot, to evaluate how much a signal will be phase-shifted. For example a signal described by: Asin(ωt) may be attenuated but also phase-shifted. If the system attenuates it by a factor x and phase shifts it by −Φ ,the signal out of the system will be (A/x) sin (ωt − Φ). The phase shift Φ is generally a function of frequency.
Phase can also be added directly from the graphical values, a fact that is mathematically clear when phase is seen as the imaginary part of the complex logarithm of a complex gain.
The magnitude and phase Bode plots can seldom be changed independently of each other — changing the amplitude response of the system will most likely change the phase characteristics and vice versa. For minimum-phase systems the phase and amplitude characteristics can be obtained from each other with the use of the Hilbert transform.
If the transfer function is a rational function with real poles and zeros, then the Bode plot can be approximated with straight lines. These asymptotic approximations are called
straight line Bode plots or
uncorrected Bode plots and are useful because they can be drawn by hand following a few simple rules. Simple plots can even be predicted without drawing them.
Magnitude plot
The magnitude (in decibels) of the transfer function above, (normalized and converted to angular frequency form), given by the decibel gain expression:
when plotted versus input frequency ω on a logarithmic scale, can be approximated by two lines and it forms the asymptotic (approximate) magnitude Bode plot of the transfer function:
- • for angular frequencies below ωc it is a horizontal line at 0 dB since at low frequencies the ω/ωc term is small and can be neglected, making the decibel gain equation above equal to zero.
- • for angular frequencies above ωc it is a line with a slope of −20 dB per decade, since at high frequencies ω/ωc term dominates and the decibel gain expression above simplifies to -20 log ω/ωc, which is a straight line with a slope of −20 dB per decade.
These two lines meet at the corner frequency. From the plot, it can be seen that for frequencies well below the corner frequency, the circuit has an attenuation of 0 dB, corresponding to a unity pass band gain, i.e. the amplitude of the filter output equals the amplitude of the input. Frequencies above the corner frequency are attenuated – the higher the frequency, the higher the attenuation.
Phase plot
The phase Bode plot is obtained by plotting the phase angle of the transfer function given by
versus ω, where ω and ωc are the input and cut-off angular frequencies respectively. For input frequencies much lower than corner, the ratio is small and therefore the phase angle is close to zero. As the ratio ω/ωc increases, the absolute value of the phase increases and becomes –45 degrees when ω = ωc . As the ratio increases for input frequencies much greater than the corner frequency, the phase angle asymptotically approaches −90 degrees. The frequency scale for the phase plot is logarithmic.
Manual
Scilab is a programming language associated with a rich collection of numerical algorithms covering many aspects of scientific computing problems.
Whatever your platform is (i.e. Windows, Linux or Mac), Scilab binaries can be downloaded directly from the Scilab homepage
or from the
Download area.
Scilab elementary mathematical operators:
+ addition
- subtraction
* multiplication
/ right division, i.e. x/y =xy-1
\ left division, i.e. x\y = x-1y
^ power, i.e. xy
** power (same as ^)
' transpose conjugate
In this scilab program
poly(0,'s') defines ‘s’ to be a polynomial variable.
syslin defines a linear system as a list and checks consistency of data.
dom='c' for a continuous time system, dom='d' for a discrete time system, n for a sampled system with sampling period n (in seconds), dom=[] if the time domain is undefined.
clf is used to reset a figure to its default values.
BodeThe Bode function plots frequency response in a Bode plot.
Procedure
- Launch scilab 5.3.3 on your computer.
- Write the scilab code given below.
Program
s=poly(0,'s')
h=syslin('c',(100)/(s^2+5*s+6))
clf();Bode(h,0.01,100);
Output :