I'm looking to plot a rectangular pulse and triangula
Mostra commenti meno recenti
I'm looking to plot a unit step function from -2 to 2 and in between there is a unit ramp that goes from -2 to 1 and back to 2. I cannot figure out how to call the functions or plot them. I am just learning the program.
Risposte (1)
michio
il 14 Set 2016
Have you looked at stairs function? For discrete data, stem function could be a choice too.
X = [0,1,2,3,4,5];
Y = [-2,1,2,-2,2];
stairs(X,Y)
ylim([-3,3])
For details and more examples, please execute
>> doc stairs
at your command window to see the documentation page.
2 Commenti
DK
il 14 Set 2016
michio
il 14 Set 2016
Hmm, I must apologize that now I do see what you are trying to achieve here.
If you use Symbolic Math Toolbox, there's a function for rectangular/triangular pulse,
http://www.mathworks.com/help/symbolic/rectangularpulse.html http://www.mathworks.com/help/symbolic/triangularpulse.html
Once you define a function, fplot can be of help in plotting. See the examples in the above URL.
Categorie
Scopri di più su Pulse and Transition Metrics in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!