필터 지우기
필터 지우기

Calculate energy from FFT

조회 수: 5 (최근 30일)
Athira Surendran
Athira Surendran 2017년 6월 17일
Hi all,
I've generated FFTs for a set of signals at different deflections. I want to calculate total energy for some frequency ranges.
  • So first I want to select the frequency ranges in which the dominant peaks of FFT are coming (each peak in each frequency range).
  • Then calculate total energy in these frequency ranges.
Following is the code I'm using for getting FFT (also attached the set of time domain signals and deflection data):
[m, n]= size(amp); % amp- amplitude data
t=linspace(0,5000,n); % time
Fs=2000000;
for i=1:m
L = n;
NFFT = 2^nextpow2(L);
UT = fft(amp(i,:),NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2);
ft(i,:) = zeros(1,NFFT/2);
ft(i,:) = UT(1:NFFT/2);
mag(i,:) = 2*abs(ft(i,:));
end;
figure
for i=1:m
plot(f,mag(i,:))
hold on;
end;
xlabel('Frequency (Hz)','fontsize',12)
ylabel('Magnitude','fontsize',12)
title('Frequency Spectrum of recieved signals','fontsize',14)
axis([0,150000,0,4])
legend(arrayfun(@(deflection) ['Deflection = ',num2str(deflection),'\mum'],deflection,'Uni',0));
set(gcf, 'Color', 'w');

답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by