Error in FFT calculation
古いコメントを表示
Why the FFT value shows higher value in the cut signal when compared to whole signal, it should be opposite right?
close all
clear all
clc
load("allSignals.mat");
Fs = 50e6; % Sampling frequency
T = 1/Fs; % Sampling period
L = 7500; % change as required
t = (0:L-1)*T; % Time vector
X = allSignals(1,:);
plot(t,X)
title("Signal ")
xlabel("t ")
ylabel("X(t)")
% fft
Y = fft(X);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1)
title("Single-Sided Amplitude Spectrum of X(t)")
xlabel("f (Hz)")
ylabel("|P1(f)|")
figure ; % after cut
X1 = allSignals(1,500:1100);
L1 = length(X1);
Y1 = fft(X1);
P21 = abs(Y1/L1);
P11 = P21(1:L1/2+1);
P11(2:end-1) = 2*P11(2:end-1);
f1 = Fs*(0:(L1/2))/L1;
plot(f1,P11)
title("Single-Sided Amplitude Spectrum of X(t)")
xlabel("f (Hz)")
ylabel("|P1(f)|")
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Event Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


