How to generate a single pulse sine wave
조회 수: 8 (최근 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!