PLOTTING TWO CYCLES SINE WAVE
Mostrar comentarios más antiguos
Hi,
I need some help for a project. I need to plot TWO cycles, frequency of 1khz sine wave with an amplitude of 5v. I'm using time as [0:2] but im not sure that's correct.
please help.
Respuesta aceptada
Más respuestas (1)
Mohamad
el 10 de Feb. de 2021
Hi , sorry for being late as I jsut saw the reply , run the code , accept the answer , thanks
%% generate and plot 2 sin(wt)
%% f= 40 Hz
f =40 ; % Sinusoid freuqncy
T=1/f; % Cycle durtation
fs=50*f; % Sampling frequency
dt=1/fs; % Sampling interval
t=0:dt:2*T-dt; % Time vector for 2 cycles
signal=2*sin(2*pi*f*t); % The required signal
plot(t,signal,'LineWidth',2) ; grid ; xlabel(' Time in Seconds ' ) ; ylabel ('Amplitude ' )
ylim([ -2.2 2.2])
1 comentario
Muhammad Adnan Liaquat
el 5 de Mzo. de 2021
Thanks brother but it's too late....
Categorías
Más información sobre Measurements and Feature Extraction en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!