generate a signal of followings notes [240 256 288 320 360 400 450 480hz] with sampling rate of 8000 samples/sec each of duration 2 sec after the delay of 1 sec?

Réponses (2)

You can generate a sine wave of given duration, amplitude, frequency and sample rate like this:
duration = 2; % second
samprate = 8000; % Hz
frequency = 240; % Hz
amplitude = 1;
t = 0:1/samprate:duration;
y = amplitude * sin(t * (2 * pi * frequency));
You can concatenate such samples together, along with some stretches of zeros, to get the signal you need.

1 commentaire

i wan to generate above notes simultaneously after the delay of 1 sec?..
can i write like
duration = 2; % second
samprate = 8000; % Hz
i=1:1:8
frequency{i} = [240 256 288 320 360 400 450 480]; % Hz
amplitude = 1;
for i=1:1:8
t = 0:1/samprate:duration;
y = amplitude * sin(t * (2 * pi * frequency));

Connectez-vous pour commenter.

nice homework and not a single mention of the signal type and amplitude, are you expecting us to do it for you? at least show some effort in solving it, I did the code, choose to do sine waves with aplitude 1 and listened to the signal, here's the output file
load signal
soundsc(signaltotal,8000);

Community Treasure Hunt

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

Start Hunting!

Translated by