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

2 次查看(过去 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