Fourier Transform of tripuls

6 ビュー (過去 30 日間)
Moisa Tedy Gabriel
Moisa Tedy Gabriel 2020 年 6 月 24 日
回答済み: Priyanshu Mishra 2020 年 7 月 29 日
Below you got what I've tried, but it does not work. The second graph does not match with the actual fft of a triangle function. Can someone help me? The use of tripuls is required! Ty!
clc
t=-2:.01:2;
subplot(2, 1, 1);
x=tripuls(t,2);
plot(t, x);
title('Triangle');
subplot(2, 1, 2);
Ts = mean(diff(t)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyuquist Frequency
L = length(x);
ftx = fft(x)/L; % Fourier Transform
ftxs = fftshift(ftx); % Shift To Centre
plot(t, ftxs);
title('TdF Triangle');

回答 (1 件)

Priyanshu Mishra
Priyanshu Mishra 2020 年 7 月 29 日
Hi Moisa,
fft is giving you a complex double values . Try taking only absolute values. I tried the following code and getting sinc squared function which is expected for a triangular pulse.
clc
t=-2:.01:2;
subplot(2, 1, 1);
x=tripuls(t,2);
plot(t, x);
title('Triangle');
subplot(2, 1, 2);
Ts = mean(diff(t)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = 2*Fs; % Nyuquist Frequency
L = length(x);
ftx = abs(fft(x)); % Fourier Transform
ftxs = fftshift(ftx); % Shift To Centre
plot(t, ftxs);
title('TdF Triangle')

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by