Why can't I get exact cosine waveform?

2 views (last 30 days)
I write following in my MATLAB to generate cosine plot. Why the peak of this wave is like triangular shape? is it a problem with plot() command?
>> t = 0:1*10^-3:40*10^-3; >> v = 120*1.41*cos(120*pi*t); >> i = (5*1.41/6)*cos(120*pi*t); >> p = v.*i; >> plot(t,p);

Accepted Answer

Star Strider
Star Strider on 1 Jun 2014
Your t vector only produces 41 points to evaluate. Change it to:
t = linspace(0,40E-3,250);
to create a vector over the same interval with 250 points. That should smooth it.
  2 Comments
Aalok Bhatt
Aalok Bhatt on 1 Jun 2014
That indeed work. Thank you for this wonderful answer..:).

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!