Help with plotting sinusoidal wave

2 次查看(过去 30 天)
Rapheal
Rapheal 2012-5-17
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

回答(1 个)

Rick Rosson
Rick Rosson 2012-5-19
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.

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by