rectangular signal, 2V amplitude and duration of 1ms, how to present the amplitude spectrum

조회 수: 4 (최근 30일)
rectangular signal, 2V amplitude and duration of 1ms, how to present the amplitude spectrum

답변 (1개)

Hari
Hari 2025년 2월 24일
Hi,
I understand that you want to present the amplitude spectrum of a rectangular signal with a 2V amplitude and a duration of 1 ms.
I assume you want to do this using the Fourier Transform.
In order to present the amplitude spectrum of the rectangular signal, you can follow the below steps:
Generate the Rectangular Signal:
Create a rectangular pulse with a specified amplitude and duration.
fs = 10000; % Sampling frequency in Hz
t = 0:1/fs:1-1/fs; % Time vector for 1 second
rect_signal = 2 * (t < 0.001); % 2V amplitude, 1ms duration
Compute the Fourier Transform:
Use the “fft” function to transform the rectangular signal into the frequency domain.
Y = fft(rect_signal);
L = length(rect_signal);
P2 = abs(Y/L); % Two-sided spectrum
P1 = P2(1:L/2+1); % Single-sided spectrum
P1(2:end-1) = 2*P1(2:end-1);
Define the Frequency Domain:
Create a frequency vector for plotting.
f_axis = fs*(0:(L/2))/L;
Plot the Amplitude Spectrum:
Visualize the single-sided amplitude spectrum.
plot(f_axis, P1);
title('Single-Sided Amplitude Spectrum of Rectangular Signal');
xlabel('Frequency (Hz)');
ylabel('|P1(f)|');
Analyze the Spectrum:
Note that the spectrum will display sinc-like characteristics due to the Fourier Transform of a rectangular pulse.
Refer to the documentation of “fft” function to know more about its usage:
Hope this helps!

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by