How to generate a single pulse sine wave
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Anurag Ojha
il 20 Ago 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 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!