Below given is a program to generate sine waveform. Parameters for the sin() and cos() functions share same typical meaning.

**%program to generate sine wave**

**f= input('enter the frequency in hertz of the sine wave');****t=0:.0001:5;****y=sin(2*pi*f*t);****plot(t,y);****ylabel ('Amplitude');****xlabel ('Time Index');****TITLE ('Sine wave');**

**%program to generate cosine wave**

**f= input('enter the frequency in hertz of the sine wave');****t=0:.0001:5;****y=cos(2*pi*f*t);****plot(t,y);****ylabel ('Amplitude');****xlabel ('Time Index');****TITLE ('cosine wave');**

## 19 comments:

Thanks a lot

Rahul m.

how to sample it?

how to take its fft?

how can i make a sinusoidal generator with a variable frequency?

how to retain curve between time 2.5 to 3.5 and rest to be zero

run nai ho raha bhadveee

tu khud gand maraaa

ghar jaake

randve

hijde

for the question: how to get fft,

ans is use fft command.

for the question : how to sample it?

ans: the output itself is a discrete signal. But, as the plot command is used,

you are getting a continuous representation.

But, you can change the sampling rate.

in second line,

t=0:.0001:5;

Here .0001 is the sampling period. change that value to change the sampling period, which in turn effects its inverse i.e., sampling frequency

how can i generate sinc wave using matlab

i want to run both waves on same plot.... running in opposite direction (animation)... can i do that, if yes then how.. please i need answer ASAP

u can draw two plots on 1 graph using hold on command.here is the example

t=0:0.01:1

f=3

w=2*pi*f

a=2

f1=2

w=2*pi*f1

a1=-1

x=a*sin(w*t)

y=a1*sin(w1*t)

hold on

plot(t,x)

plot(t,y,'p')

title('Graph')

run this command on matlab.., hope thz will help.., thanks

i want to shift the modulated sine wave with period of 31.6microseconds is this possible???? plz answer my q'tn.....

super

what a program ya amazing ya

hey its super ya what ya amazing ya

the code is so lengthy

tq..i'm chaitu

bhosdike

## Post a Comment