Help with plotting sinusoidal wave
1 view (last 30 days)
Show older comments
Hello, Im trying to plot a sinusoidal wave x(t) = 4cos(10*pi*t-pi/2) from -0.2 to 0.5 with 0.05 interval. The plot i get in matlab is a triangular wave and not a sinusoidal wave. am i missing any thing? :(
F = 5; A = 4; t = -0.2:0.05:0.5; phi = -pi/2; x = A*cos(2*pi*t*F + phi); plot(t,x) grid on
0 Comments
Answers (1)
Rick Rosson
on 19 May 2012
Compare your sampling rate (in samples per second) to the frequency of your sine wave (in hertz or cycles per second). What is the ratio (both numerical value and units of measure) of the sampling rate to the sine wave's frequency? What does this information imply about the sampled sine wave and the triangle wave that you are seeing?
To see what is happening a bit more clearly, try using the stem function instead of plot.
stem(t,x);
HTH.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!