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

3 vues (au cours des 30 derniers jours)
rectangular signal, 2V amplitude and duration of 1ms, how to present the amplitude spectrum

Réponses (1)

Hari
Hari le 24 Fév 2025
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!

Catégories

En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by