Help with plotting sinusoidal wave

조회 수: 3 (최근 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