How to find proper frequency peaks within a frequency spectrum?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Mathieu NOE
am 19 Dez. 2022
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
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!