Multiple sine periods with a specific fundamental frequency

6 visualizaciones (últimos 30 días)
Nani Maryson
Nani Maryson el 5 de Oct. de 2019
Editada: Daniel M el 5 de Oct. de 2019
I'm trying to make 5 periods of a SINE signal with fundamental frequency f=100Hz, sampled at frequency fs=20*f=2000Hz but unfortuately I don't know what is wrong.
%%Time specifications:
Fs = 20; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 0.16; % seconds
t = (0:dt:StopTime-dt)'; % seconds
%%Sine wave:
Fc = 2000; % hertz
x = sin(2*pi*Fc*t);
% Plot the signal versus time:
figure;
plot(t,x);
xlabel('time (in seconds)');
title('Signal versus Time');
zoom xon;

Respuestas (1)

Daniel M
Daniel M el 5 de Oct. de 2019
Editada: Daniel M el 5 de Oct. de 2019
%%Time specifications:
Fc = 100; % fundamental
Fs = 20*Fc; % sampling rate
dt = 1/Fs; % sampling period
StopTime = 5/Fc; % num periods * length of a period
t = (0:dt:StopTime-dt)'; % seconds
%%Sine wave:
x = sin(2*pi*Fc*t);
% Plot the signal versus time:
figure;
plot(t,x);
xlabel('time (in seconds)');
title('Signal versus Time');
zoom xon

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by