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

4 ビュー (過去 30 日間)
lolo lolo
lolo lolo 2017 年 5 月 2 日
回答済み: Hari 2025 年 2 月 24 日
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 Center および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by