plot a cosine function

Status
Not open for further replies.

sa gharibi

Newbie level 3
Joined
Dec 3, 2013
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
19
I want to plot cos(2*pi *t) over t=[0 1] with 30 samples,please help me.
 
Last edited:

You can do this with Matlab or GNU Octave (a free alternative), using the following code:

Code:
t = linspace(0,1,30);
plot(t, cos(2*pi*t));

The first line creates 30 linearly-spaced time intervals over [0,1]. The second line computes the cosine and plots it against t.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…