Monday, May 17, 2010

How to plot a sine wave in MATLAB?

How to plot a sine wave with frequency f(Hz) and amplitude A?

In the command window:

t=[0:0.00001:0.2];
%t is a vector with value 0 to 0.2 at 0.00001 increments

A=10
%10 is the maximum amplitude of the sine wave

f=60
%60 is the frequency


y=A*sin(2*pi*f*t);
plot(t,y)


The graph should look like this.




No comments:

Post a Comment