Help with plotting sinusoidal wave

3 visualizaciones (últimos 30 días)
Rapheal
Rapheal el 17 de Mayo de 2012
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

Respuestas (1)

Rick Rosson
Rick Rosson el 19 de Mayo de 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.

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by