Triangular wave form plot
3 views (last 30 days)
Show older comments
Rashmil Dahanayake
on 9 Dec 2013
Commented: Rashmil Dahanayake
on 10 Dec 2013
Hi, I'm trying to generate a 140Hz triangular wave.
Following code produce the correct plot up to 100HZ. Once I enter the value beyond 100hz (eg 140hz) the plot doesn't seems to be correct.
t=0:.001:1.5 ;
x = sawtooth (2 * pi * 140 * t , 0.5); % 0.5 specify a symmetric triangular shape
plot(t,x); axis ( [ 0 0.01 -1 1 ] );
Is it some thing to do with the code of the plot figure settings?
0 Comments
Accepted Answer
Walter Roberson
on 9 Dec 2013
sawtooth() already does a 2*pi conversion internally. A value of 1 for time corresponds to one full cycle of the triangle wave. Your pre-multiplication by 2*pi is throwing that off.
More Answers (0)
See Also
Categories
Find more on Annotations 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!