calculating energy from FFT in different frequency bins
13 次查看(过去 30 天)
显示 更早的评论
Hi all,
I've generated FFTs for a set of signals in time domain at different deflections. I want to find in which frequency range the signal is more sensitive. Can someone help me do the following since I'm new to programming and signal processing??
Here's my problem:
- So I want to select a frequency range in which all the dominant peaks are coming .
( In this case, by looking at the figure, the frequency range to be considered would be somewhere between 35000Hz-125000Hz (Is there a way to automatically find this ?) Also I don't know where to fix the threshold.)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/165163/image.png)
- Divide it into a number of bins (not more than 10) in such a way that each peak should fall completely within one of these bins. (bins need not be of equal length and should be same for all signals)
- Then, calculate the energy for each bin in each signal.
- Then plot curves for each bin showing the variation of energy in each bin with respect to deflection. (ie. deflection on x-axis and area under curve on y axis.)
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');
回答(1 个)
Michael Dombrowski
2017-6-29
I suggest you have a look at the findpeaks function and the named values NPeaks, MinPeakHeight, Threshold, and MinPeakDistance.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!