View Single Post
  #2  
Old 07-12-2007, 11:45 AM
m_the0ry m_the0ry is offline
Senior Member
 
Join Date: Aug 2006
Posts: 790
Default Re: Graphing in matlab

first you generate the independent variable array, which you have designated as being -60 to 80.

x = [-60:.1:80]

this makes our x array span from -60 to 80 with .1 between each array value. This gives us good resolution because there are 2pi/.1 or 20pi samples per oscillation of the wave. If this resolution is not high enough for your application you will need to lower the step size by decreasing the value of the number in the middle of the expression.

Once you have a good array set up, enter

y = 36.8cos(x)

and then

plot(x,y)
Reply With Quote