How to plot Bode diagram with straight line approximation? - matlab

If I use the bode (tf(num,den)) function to plot the Bode diagram I get a curved version. Is it possible to get a straight line version (as if you would calculate by hand)? Also, would it be possible to show the component lines that make the Bode diagram?
Thanks in advance!

What you want is called Asymptotic Bode Diagram.
Matlab does not sketch the Bode plot, it evaluates the transfer function at various frequencies and draw modulus and phase on the two diagrams.
I found a script in matlab central, I didn't try it but maybe it is enough for you.
Greetings,
Nicola

Related

How do I implement a parallel coordinates plot in MATLAB?

I am trying to implement this plot
Any ideas or advice for how to implement a parallel coordinates plot in MATLAB?
Please see parallelcoords. Adding new Y-axis is done manually via line(...). Another way to make parallel coordinates plot is to use the function form SAFE Toolbox
If you have MATLAB R2019a or later, you can use parallelplot
If you have an earlier version of MATLAB and you have the Statistics and Machine Learning Toolbox, you can use parallelcoords
There are some other implementations on the MATLAB File Exchange, of which Interactive Parallel Coordinates is worth a look.

Bode curve in simulink

I try to simulate a power electronic chopper like buck or boost or any of them to get the bode plot of model. but I can't do that.in the other word I can't use bode block in simulink.
please help me
Since the introduction of the Simulink Control Design Toolbox, you can use following approach to get the Bode plots of a Simulink model. You can find a more detailed explanation of this approach here.

MATLAB : Does the command "contour" give the streamlines in a flow simulation?

I'm not sure what command to use on matlab to plot the streamlines in a flow simulation. I used the command "contour" but it seems that it is not the right one.
I tried to use the commands "streamline" and "stream2d" but the starting points are really difficult to choose.
I found the solution it is "quiver" command (if case anyone needs this)
quiver command is used to generate vector field which predict the direction of velocity components while streamline command is used to generate streamlines. contour plot is basically a surface plot which can be used to plot stream function.

Plotting a Histogram in Matlab with Descriptive Statistics

Is is possible to plot a histogram in MATLAB where the summary statistics are displayed in the histogram?
Here is an example of what I want generated in Mathematica
I've looked on the web but can't find an example like this in MATLAB anywhere?
You can use the text() function to add anything you want to a plot in MATLAB.
Alternatively, you can use textbp(), as pointed out by Daniel. textbp() will automatically choose the best position to place text.

How to generate a curve using matlab simulink

How to generate the curve of transfer function:
G0(s)=exp(-s)*[(2s+4)/(s^3+5s^2+6s+4)]
using MATLAB and Simulink?
What kind of curve do you mean? Bode plot? Nyquist plot? Step response?
Use the tf function to create your transfer function with the InputDelay parameter to represent the exp(-s), see Models with Time Delays in the documentation for more details.
Once you have your transfer function, you can use functions like bode, nyquist, step, impulse, etc... to generate your "curve" of choice.
All of this requires the Control System Toolbox.