How to plot phase margin
1 view (last 30 days)
Show older comments
I am new on matlab and want to plot phase margin from equation. The equations are given below. A=(pi-(w+tan^-1((uw+sinw)/(1-cosw))))*(180/pi). How to plot this equation A vs w?
0 Comments
Answers (1)
Sebastian Castro
on 16 Apr 2015
One of the most awesome things about MATLAB is the "dot multiply" and "dot divide" operators that lets you do this relatively easily.
The first step is to create a vector of "w" values. Below are a few ways.
% This first vector starts at 1 and ends at 1000, in increments of 10.
w = 1:10:1000;
% This second vector does something similar, but with logarithmic spacing (which is more common for frequency sweeps) - Starts at 10^0, ends at 10^3, 100 total data points.
w = logspace(0,3,100);
Next, you compute the corresponding "A" values and plot them. Notice that the expression is basically exactly the same as the one you gave, except for the "dot divide" operation. This makes sure that the vectors are divided element-by-element instead of with matrix operations.
A = (pi - w + atan( (u*w + sin(w)) ./ (1 - cos(w)))) * (180/pi);
plot(w,A)
- Sebastian
0 Comments
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!