How to find proper frequency peaks within a frequency spectrum?
3 次查看(过去 30 天)
显示 更早的评论
Hello there,
I am trying to detect any mechanical issues these require maintenance by observing the feature's frequency spectrums created via data taken from accelerometer calculations which are made axial and radial (saved as .mat). I have to measure peak frequencies properly by using the code given by my instructor -he also insisted that I am obliged to use the code as it is- in order to get an idea about the condition of the system but I can't make programatical data tips that automatically detects peak frequencies in a reasonable threshold and margin. How can I get those data tips? My code is shown below, thank you for your time already.
clc
clear
load BR.mat %%%data file
x=BR; %%%%%%Data file name
sp=fft(x);
nn=length(x);
sp(1:2)=zeros(size(1:2));
sp(nn-1:nn)=zeros(size(1:2));
x=real(ifft(sp));
fss=5000;
T=1/fss;
upfreq=fss/2;
p1=length(x);
z=(2/p1)*abs(fft(x));
z=z(1:p1/2-1);
z(1,1)=0.5*z(1,1);
nff=length(z);
nf1=round(2*nff*upfreq/fss);
z=z(1:nf1);
freqspec=plot((0:nf1-1).*(fss/p1),abs(z)),
set(gca,'FontSize',10), xlabel('Frequency (Hz)'),ylabel('Amplitude')
axis([0 2500 0 0.05])
zoom on
1 个评论
Mathieu NOE
2022-12-19
hello
look for findpeaks
you can also use text to create annotations inside the figure, once you know the x, y coordnates of the selected peaks
回答(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!