How to generate a single pulse sine wave
18 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Anurag Ojha
2024-8-20
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!