Bode plot of frequency response, or magnitude and phase data (2024)

Bode plot of frequency response, or magnitude and phasedata

collapse all in page

Syntax

bode(sys)

bode(sys1,sys2,...,sysN)

bode(sys1,LineSpec1,...,sysN,LineSpecN)

bode(___,w)

[mag,phase,wout]= bode(sys)

[mag,phase,wout]= bode(sys,w)

[mag,phase,wout,sdmag,sdphase]= bode(sys,w)

Description

example

bode(sys) createsa Bode plot of the frequency response of a dynamicsystem model sys. The plot displaysthe magnitude (in dB) and phase (in degrees) of the system responseas a function of frequency. bode automaticallydetermines frequencies to plot based on system dynamics.

If sys is a multi-input, multi-output (MIMO)model, then bode produces an array of Bode plots,each plot showing the frequency response of one I/O pair.

If sys is a model with complex coefficients, then in:

  • Log frequency scale, the plot shows two branches, one for positive frequencies and one for negative frequencies. The plot also shows arrows to indicate the direction of increasing frequency values for each branch. See Bode Plot of Model with Complex Coefficients.

  • Linear frequency scale, the plot shows a single branch with a symmetric frequency range centered at a frequency value of zero.

example

bode(sys1,sys2,...,sysN) plots the frequencyresponse of multiple dynamic systems on the same plot. All systemsmust have the same number of inputs and outputs.

example

bode(sys1,LineSpec1,...,sysN,LineSpecN) specifies a color, line style, and marker for each system in the plot.

example

bode(___,w) plotssystem responses for frequencies specified by w.

  • If w is a cell array of the form {wmin,wmax},then bode plots the response at frequencies rangingbetween wmin and wmax.

  • If w is a vector of frequencies, then bode plots the response at each specified frequency. The vector w can contain both negative and positive frequencies.

You can use w with any of the input-argumentcombinations in previous syntaxes.

example

[mag,phase,wout]= bode(sys) returns the magnitudeand phase of the response at each frequency in the vector wout.The function automatically determines frequencies in wout basedon system dynamics. This syntax does not draw a plot.

example

[mag,phase,wout]= bode(sys,w) returnsthe response data at the frequencies specified by w.

  • If w is a cell array of the form {wmin,wmax},then wout contains frequencies ranging between wmin and wmax.

  • If w is a vector of frequencies,then wout = w.

example

[mag,phase,wout,sdmag,sdphase]= bode(sys,w) alsoreturns the estimated standard deviation of the magnitude and phasevalues for the identified model sys.If you omit w, then the function automaticallydetermines frequencies in wout based on systemdynamics.

Examples

collapse all

Bode Plot of Dynamic System

This example uses:

  • Control System ToolboxControl System Toolbox

Open Live Script

Create a Bode plot of the following continuous-time SISO dynamic system.

H(s)=s2+0.1s+7.5s4+0.12s3+9s2.

H = tf([1 0.1 7.5],[1 0.12 9 0 0]);bode(H)

Bode plot of frequency response, or magnitude and phasedata (1)

bode automatically selects the plot range based on the system dynamics.

Bode Plot at Specified Frequencies

This example uses:

  • Control System ToolboxControl System Toolbox

Open Live Script

Create a Bode plot over a specified frequency range. Use this approach when you want to focus on the dynamics in a particular range of frequencies.

H = tf([-0.1,-2.4,-181,-1950],[1,3.3,990,2600]);bode(H,{1,100})grid on

Bode plot of frequency response, or magnitude and phasedata (2)

The cell array {1,100} specifies the minimum and maximum frequency values in the Bode plot. When you provide frequency bounds in this way, the function selects intermediate points for frequency response data.

Alternatively, specify a vector of frequency points to use for evaluating and plotting the frequency response.

Bode plot of frequency response, or magnitude and phasedata (3)

bode plots the frequency response at the specified frequencies only.

Compare Bode Plots of Several Dynamic Systems

This example uses:

  • Control System ToolboxControl System Toolbox

Open Live Script

Compare the frequency response of a continuous-time system to an equivalent discretized system on the same Bode plot.

Create continuous-time and discrete-time dynamic systems.

H = tf([1 0.1 7.5],[1 0.12 9 0 0]);Hd = c2d(H,0.5,'zoh');

Create a Bode plot that displays both systems.

bode(H,Hd)

Bode plot of frequency response, or magnitude and phasedata (4)

The Bode plot of a discrete-time system includes a vertical line marking the Nyquist frequency of the system.

Bode Plot with Specified Line Attributes

This example uses:

  • Control System ToolboxControl System Toolbox

Open Live Script

Specify the line style, color, or marker for each system in a Bode plot using the LineSpec input argument.

H = tf([1 0.1 7.5],[1 0.12 9 0 0]);Hd = c2d(H,0.5,'zoh');bode(H,'r',Hd,'b--')

Bode plot of frequency response, or magnitude and phasedata (5)

The first LineSpec, 'r', specifies a solid red line for the response of H. The second LineSpec, 'b--', specifies a dashed blue line for the response of Hd.

Obtain Magnitude and Phase Data

This example uses:

  • Control System ToolboxControl System Toolbox

Open Live Script

Compute the magnitude and phase of the frequency response of a SISO system.

If you do not specify frequencies, bode chooses frequencies based on the system dynamics and returns them in the third output argument.

H = tf([1 0.1 7.5],[1 0.12 9 0 0]);[mag,phase,wout] = bode(H);

Because H is a SISO model, the first two dimensions of mag and phase are both 1. The third dimension is the number of frequencies in wout.

size(mag)
ans = 1×3 1 1 41
length(wout)
ans = 41

Thus, each entry along the third dimension of mag gives the magnitude of the response at the corresponding frequency in wout.

Magnitude and Phase of MIMO System

This example uses:

  • Control System ToolboxControl System Toolbox

Open Live Script

For this example, create a 2-output, 3-input system.

rng(0,'twister'); % For reproducibilityH = rss(4,2,3);

For this system, bode plots the frequency responses of each I/O channel in a separate plot in a single figure.

bode(H)

Bode plot of frequency response, or magnitude and phasedata (6)

Compute the magnitude and phase of these responses at 20 frequencies between 1 and 10 radians.

w = logspace(0,1,20);[mag,phase] = bode(H,w);

mag and phase are three-dimensional arrays, in which the first two dimensions correspond to the output and input dimensions of H, and the third dimension is the number of frequencies. For instance, examine the dimensions of mag.

size(mag)

Thus, for example, mag(1,3,10) is the magnitude of the response from the third input to the first output, computed at the 10th frequency in w. Similarly, phase(1,3,10) contains the phase of the same response.

Bode Plot of Identified Model

Open Live Script

Compare the frequency response of a parametric model, identified from input/output data, to a nonparametric model identified using the same data.

Identify parametric and nonparametric models based on data.

load iddata2 z2;w = linspace(0,10*pi,128);sys_np = spa(z2,[],w);sys_p = tfest(z2,2);

Using the spa and tfest commands requires System Identification Toolbox™ software.

sys_np is a nonparametric identified model. sys_p is a parametric identified model.

Create a Bode plot that includes both systems.

bode(sys_np,sys_p,w);legend('sys-np','sys-p')

Bode plot of frequency response, or magnitude and phasedata (7)

You can display the confidence region on the Bode plot by right-clicking the plot and selecting Characteristics > Confidence Region.

Obtain Magnitude and Phase Standard Deviation Data of Identified Model

Open Live Script

Compute the standard deviation of the magnitude and phase of an identified model. Use this data to create a 3σ plot of the response uncertainty.

Identify a transfer function model based on data. Obtain the standard deviation data for the magnitude and phase of the frequency response.

load iddata2 z2;sys_p = tfest(z2,2);w = linspace(0,10*pi,128);[mag,ph,w,sdmag,sdphase] = bode(sys_p,w);

Using the tfest command requires System Identification Toolbox™ software.

sys_p is an identified transfer function model. sdmag and sdphase contain the standard deviation data for the magnitude and phase of the frequency response, respectively.

Use the standard deviation data to create a 3σ plot corresponding to the confidence region.

mag = squeeze(mag);sdmag = squeeze(sdmag);semilogx(w,mag,'b',w,mag+3*sdmag,'k:',w,mag-3*sdmag,'k:');

Bode plot of frequency response, or magnitude and phasedata (8)

Bode Plot of Model with Complex Coefficients

This example uses:

  • Control System ToolboxControl System Toolbox

Open Live Script

Create a Bode plot of a model with complex coefficients and a model with real coefficients on the same plot.

rng(0)A = [-3.50,-1.25-0.25i;2,0];B = [1;0];C = [-0.75-0.5i,0.625-0.125i];D = 0.5;Gc = ss(A,B,C,D);Gr = rss(5);bode(Gc,Gr)legend('Complex-coefficient model','Real-coefficient model','Location','southwest')

Bode plot of frequency response, or magnitude and phasedata (9)

In log frequency scale, the plot shows two branches for complex-coefficient models, one for positive frequencies, with a right-pointing arrow, and one for negative frequencies, with a left-pointing arrow. In both branches, the arrows indicate the direction of increasing frequencies. The plots for real-coefficient models always contain a single branch with no arrows.

You can change the frequency scale of the Bode plot by right-clicking the plot and selecting Properties. In the Property Editor dialog, on the Units tab, set the frequency scale to linear scale. Alternatively, you can use the bodeplot function with a bodeoptions object to create a customized plot.

opt = bodeoptions;opt.FreqScale = 'Linear';

Create the plot with customized options.

bodeplot(Gc,Gr,opt)legend('Complex-coefficient model','Real-coefficient model','Location','southwest')

Bode plot of frequency response, or magnitude and phasedata (10)

In linear frequency scale, the plot shows a single branch with a symmetric frequency range centered at a frequency value of zero. The plot also shows the negative-frequency response of a real-coefficient model when you plot the response along with a complex-coefficient model.

Input Arguments

collapse all

sysDynamic system
dynamic system model | model array

Dynamic system, specified as a SISO or MIMO dynamic system model or array of dynamic system models. Dynamic systems that you can use include:

  • Continuous-time or discrete-time numeric LTI models, such as tf (Control System Toolbox), zpk (Control System Toolbox), or ss (Control System Toolbox) models.

  • Generalized or uncertain LTI models such as genss (Control System Toolbox) or uss (Robust Control Toolbox) models. (Using uncertain models requires Robust Control Toolbox™ software.)

    • For tunable control design blocks, the function evaluates the model at its current value for both plotting and returning frequency response data.

    • For uncertain control design blocks, the function plots the nominal value and random samples of the model. When you use output arguments, the function returns frequency response data for the nominal model only.

  • Frequency-response data models such as frd models. For such models, the function plots the response at frequencies defined in the model.

  • Identified LTI models, such as idtf, idss, or idproc models. For such models, the function can also plot confidence intervals and return standard deviations of the frequency response. See Bode Plot of Identified Model.

If sys is an array of models, the function plots the frequency responses of all models in the array on the same axes.

wFrequencies
{wmin,wmax} | vector

Frequencies at which to compute and plot frequency response, specified as the cell array {wmin,wmax} or as a vector of frequency values.

  • If w is a cell array of the form {wmin,wmax}, then the function computes the response at frequencies ranging between wmin and wmax.

  • If w is a vector of frequencies, then the function computes the response at each specified frequency. For example, use logspace to generate a row vector with logarithmically spaced frequency values. The vector w can contain both positive and negative frequencies.

For models with complex coefficients, if you specify a frequency range of [wmin,wmax] for your plot, then in:

  • Log frequency scale, the plot frequency limits are set to [wmin,wmax] and the plot shows two branches, one for positive frequencies [wmin,wmax] and one for negative frequencies [–wmax,–wmin].

  • Linear frequency scale, the plot frequency limits are set to [–wmax,wmax] and the plot shows a single branch with a symmetric frequency range centered at a frequency value of zero.

Specify frequencies in units of rad/TimeUnit, where TimeUnit is the TimeUnit property of the model.

Output Arguments

collapse all

mag — Magnitude of system response
3-D array

Magnitude of the system response in absolute units, returnedas a 3-D array. The dimensions of this array are (number of systemoutputs) × (number of system inputs) × (number of frequencypoints).

  • For SISO systems, mag(1,1,k) givesthe magnitude of the response at the kth frequencyin w or wout. For an example,see Obtain Magnitude and Phase Data.

  • For MIMO systems, mag(i,j,k) givesthe magnitude of the response at the kth frequencyfrom the jth input to the ithoutput. For an example, see Magnitude and Phase of MIMO System.

To convert the magnitude from absolute units to decibels, use:

magdb = 20*log10(mag)

phase — Phase of system response
3-D array

Phase of the system response in degrees, returned as a 3-D array.The dimensions of this array are (number of outputs) × (numberof inputs) × (number of frequency points).

  • For SISO systems, phase(1,1,k) gives the phase of the response at the kth frequency in w or wout. For an example, see Obtain Magnitude and Phase Data.

  • For MIMO systems, phase(i,j,k) gives the phase of the response at the kth frequency from the jth input to the ith output. For an example, see Magnitude and Phase of MIMO System.

wout — Frequencies
vector

Frequencies at which the function returns the system response, returned as a column vector. The function chooses the frequency values based on the model dynamics, unless you specify frequencies using the input argument w.

wout also contains negative frequency values for models with complex coefficients.

Frequency values are in radians/TimeUnit, where TimeUnit is the value of the TimeUnit property of sys.

sdmag — Standard deviation of magnitude
3-D array | []

Estimated standard deviation of the magnitude of the responseat each frequency point, returned as a 3-D array. sdmag hasthe same dimensions as mag.

If sys is not an identified LTI model, sdmag is [].

sdphase — Standard deviation of phase
3-D array | []

Estimated standard deviation of the phase of the response ateach frequency point, returned as a 3-D array. sdphase hasthe same dimensions as phase.

If sys is not an identified LTI model, sdphase is [].

Tips

  • When you need additional plot customization options,use bodeplot (Control System Toolbox) instead.

Algorithms

bode computes the frequency response asfollows:

  1. Compute the zero-pole-gain (zpk (Control System Toolbox))representation of the dynamic system.

  2. Evaluate the gain and phase of the frequency responsebased on the zero, pole, and gain data for each input/output channelof the system.

    • For continuous-time systems, bode evaluatesthe frequency response on the imaginary axis s = andconsiders only positive frequencies.

    • For discrete-time systems, bode evaluatesthe frequency response on the unit circle. To facilitate interpretation,the command parameterizes the upper half of the unit circle as:

      z=ejωTs,0ωωN=πTs,

      where Ts is the sampletime and ωN is theNyquist frequency. The equivalent continuous-time frequency ω isthen used as the x-axis variable. Because H(ejωTs) isperiodic with period 2ωN, bode plotsthe response only up to the Nyquist frequency ωN.If sys is a discrete-time model with unspecifiedsample time, bode uses Ts =1.

Version History

Introduced before R2006a

See Also

bodeplot | freqresp | nyquist | spectrum | step

Topics

  • Plot Bode and Nyquist Plots at the Command Line
  • Dynamic System Models

External Websites

  • Transfer Function Analysis of Dynamic Systems (MathWorks Teaching Resources)

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Bode plot of frequency response, or magnitude and phasedata (11)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

Bode plot of frequency response, or magnitude and phase
data (2024)

FAQs

What is a Bode plot with magnitude plot and phase plot? ›

Bode plots show the frequency response, that is, the changes in magnitude and phase as a function of frequency. This is done on two semi-log scale plots. The top plot is typically magnitude or “gain” in dB. The bottom plot is phase, most commonly in degrees.

What is the magnitude and phase of frequency response? ›

The magnitude describes the strength of each frequency in the signal. The phase describes the sine/cosine phase of each frequency. The phase can also be thought of as the relative proportion of sines and cosines in the signal (i.e., a phase of zero contains only cosines and a phase of 90 degrees contains only sines).

What is the frequency response analysis Bode plot? ›

Understanding frequency response analysis plots

In the Bode plot seen in Figure 1, the top half shows us gain (db) vs. frequency (Hz), while the bottom half shows us phase (°) vs. frequency (Hz). To observe a wide range of frequencies, frequency is plotted on a logarithmic scale.

How do you find the magnitude of a Bode plot? ›

To find the magnitude of the output, simply multiply the magnitude of the input (A) by the magnitude of the transfer function (M). The phase of the output is sum of the input phase (φ) and the phase of the transfer function (θ).

What does the phase of a Bode plot tell you? ›

The phase plot shows how the phase shift develops when the source frequency starts to enter the cutoff region. Here, when the phase shift in the Bode plot is 45 degrees, the magnitude curve passes through approximately -3 dB.

How much phase margin is enough? ›

The phase margin is defined as the negative change in open-loop phase shift required to make a closed-loop system unstable. In general, a well-designed feedback loop has a phase margin of at least 45° and a G.M. > 3 or so.

What is the relation between phase and frequency response? ›

The frequency is inversely proportional to the time interval for 1 degree of phase. The frequency of a signal is given by f, and the time the (in secs) regarding one degree of phase is the = 1 / (360f) = T / 360. Therefore, a one-degree phase shift on a 5 MHz signal shows a time shift of 555 picoseconds.

How to find magnitude and phase response of a system? ›

A geometric way to obtain approximate magnitude and phase frequency responses is using the effects of zeros and poles on the frequency response of an LTI system. G ( s ) | s = j Ω 0 = K j Ω 0 − z j Ω 0 − p = K Z → ( Ω 0 ) P → ( Ω 0 ) .

What is its effect on magnitude and phase response? ›

Answer. Effect compresses the magnitude and phase response. This effect is called warping effect.

Why do we plot frequency response? ›

With the graphs of the system's magnitude and phase response as a function of frequency, commonly referred to as a Bode plot, engineers can optimize the closed-loop response of control systems, characterize resonant behavior in nonlinear systems, design filters, and measure the bandwidth of different electronic or ...

How do you interpret a frequency response graph? ›

Frequency Response

Theoretically, this graph should be a flat line at 0dB. The left-hand side of the line is the bass, the right side is the treble. If the line is high on the left and low on the right, the headphones would be considered bass heavy.

What is the magnitude plot and phase plot? ›

For a constant term, the magnitude plot is a straight line. The phase plot is also a straight line, either at 0° (for a positive constant) or ±180° (for a negative constant).

What is the absolute magnitude Bode plot? ›

The Bode magnitude plot is a graph of the absolute value of the gain of a circuit, as a function of frequency. The gain is plotted in decibels, while frequency is shown on a logarithmic scale. It is therefore a log–log plot.

How do you draw a Bode magnitude plot from a transfer function? ›

Bode Plot: Example 7
  1. Step 1: Rewrite the transfer function in proper form. ...
  2. Step 2: Separate the transfer function into its constituent parts. ...
  3. Step 3: Draw the Bode diagram for each part. ...
  4. Step 4: Draw the overall Bode diagram by adding up the results from step 3.

What is a magnitude vs phase plot? ›

In magnitude and phase plots, as ω goes through a zero on the unit circle, the magnitude will go to zero and the phase will flip by π, as shown in the figure below. If H(ejω) is real but bipolar, it's often more natural to use an alternative representation to remove these jumps of π in a phase plot.

What does a phase plot represent? ›

The phase plot consists of a smooth curve showing how x1 and x2 evolve over time from initial conditions. Each point on the curve has a vector tangent to the curve whose magnitude and direction are defined by ( x ˙ 1 , x ˙ 2 ) , the vector field.

What is meant by magnitude plot? ›

the magnitude plot is a straight line with a slope of 20 d B per decade, passing through the abscissa axis at ω = 1 rad/s, and the phase plot is a constant equal to 90 ∘ (Fig. 5.9): Figure 5.9. Bode plots of the monomial term j ω . | j ω | d B = 20 log 10 ω , 1 j ω = − 90 ∘ .

How do you draw a Bode plot phase diagram? ›

Key Concept - To draw Bode diagram there are four steps:
  1. Rewrite the transfer function in proper form.
  2. Separate the transfer function into its constituent parts.
  3. Draw the Bode diagram for each part.
  4. Draw the overall Bode diagram by adding up the results from part 3.

Top Articles
The Daily Sentinel from Scottsboro, Alabama
Editorials published by father of novelist Harper Lee
LOST JEEPS • View forum
Monthly Weather Calendar
Futuretechgirls Contact
Schluter & Balik Funeral Home Obituaries
Defense Immunity 2K23 Meaning
2 værelses hus i Ejby
Nsu Kpcom Student Handbook
Sandals Travel Agent Login
2320 Pioneer Rd
Texas (TX) Lottery - Winning Numbers & Results
The 15 Best Things to Do in Branson, Missouri
Roses Gordon Highway
Power Outage Hales Corners
Fd Photo Studio New York
Real Caca Girl Leak
Evil Dead Rise Showtimes Near Cinemark Movies 10
Tyrone Unblocked Games Bitlife
Identogo Roanoke Va
2022 NFL Predictions
Software For Organizing A Pledge Drive Crossword Clue
Education (ED) | Pace University New York
Walmart Careers Stocker
The Professor Tape 1 Prof Snow Myvidster
Wirrig Pavilion Seating Chart
3850 Colonial Blvd Suite 100 Fort Myers Fl 33966
Chris Bailey Weather Forecast
Lufthansa LH456 (DLH456) from Frankfurt to Los Angeles
Look Who Got Busted New Braunfels
Adriana Zambrano | Goosehead Insurance Agent in Metairie, Louisiana
Netronline Historic Aerials
How to Choose Where to Stay When You Visit Pittsburgh
Obituaries Cincinnati Enquirer
Claudia Capertoni Only Fans
Agility Armour Conan Exiles
Smarthistory – Leonardo da Vinci, “Vitruvian Man”
Mario Party Superstars Rom
Is Glassagram Illegal
C And B Processing
Luoghi MA.R.C.I.: Norma e Classificazione
Paychex Mobile Apps - Easy Access to Payroll, HR, & Other Services
Winding Road Ahead for China’s EV Growth
Research Tome Neltharus
Eurorack Cases & Skiffs
The Hollis Co Layoffs
Dungeon Family Strain Leafly
Shooters Supply Westport
Morse Road Bmv Hours
Make Monday Better: Dive Into These Hilarious Monday Memes!
Only Partly Forgotten Wotlk
Cpc 1190 Pill
Latest Posts
Article information

Author: Duane Harber

Last Updated:

Views: 6352

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Duane Harber

Birthday: 1999-10-17

Address: Apt. 404 9899 Magnolia Roads, Port Royceville, ID 78186

Phone: +186911129794335

Job: Human Hospitality Planner

Hobby: Listening to music, Orienteering, Knapping, Dance, Mountain biking, Fishing, Pottery

Introduction: My name is Duane Harber, I am a modern, clever, handsome, fair, agreeable, inexpensive, beautiful person who loves writing and wants to share my knowledge and understanding with you.