How to generate a single pulse sine wave
20 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nupur
el 20 de Ag. de 2024
Respondida: Anurag Ojha
el 20 de Ag. de 2024
I want to generate a single pulse sine wave which starts at 20 sec and goes to zero after one full period. The frequency of of the pulse should be 0.5 hz and the amplitude 1 and the sampling rate 0.05 sec.
Please let me know.
0 comentarios
Respuesta aceptada
Anurag Ojha
el 20 de Ag. de 2024
Hi Nupur
To generate a single pulse sine wave with the given specifications, you can refer to following MATLAB code:
% Define the time vector
t = 0:0.05:40;
% Generate the sine wave
f = 0.5; % Frequency in Hz
A = 1; % Amplitude
x = A*sin(2*pi*f*t);
% Create the pulse
pulse_start = 20; % Start time of the pulse in seconds
pulse_duration = 1/f; % Duration of the pulse in seconds
pulse_end = pulse_start + pulse_duration; % End time of the pulse in seconds
pulse = x.*(t >= pulse_start & t <= pulse_end);
% Plot the pulse sine wave
plot(t, pulse)
xlabel('Time (s)')
ylabel('Amplitude')
title('Single Pulse Sine Wave')
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!