How to make an FRF with my accelerometer Data and FFT?
Afficher commentaires plus anciens
Dear, Matlab Users.
I have some inquiries about my accelerometer Data, that was processed by a Dewesoft Software.
So, I am gonna share my code and data, and I would like to know if there any suggestion to this resolution.
Sensitivy: 102 mV/g, or 10.40 mV/m/s^2
%Load data
clear all
load("C:\Users\joant\Desktop\Field_Research\Matlab_Code\data_test.mat")
whos
close all
%Plot the array according to the data
%Data of Channel 1
g1= transpose(Data1_352C33OLD)
t1= transpose(Data1_time_352C33OLD); % time
dt=1/(Sample_rate) % period
L=length(g1)
%Iterate
% Figure of Channel 1
figure(1)
plot(t1,g1,'b.-')
set(gca,'Fontsize',14)
xlabel('time(s)')
ylabel('g')
xlim([min(t1) max(t1)])
%ylim([-6 6])
grid on
% Calculate Fourier transform of force
points=round((t1(L))/dt) %Calculate the points
A_F= g1; % This is the Force for setting in the fft.
freq= (0:1/(dt*points):(1-1/(2*points))/dt)'; %Hz
freq=freq(1:round(points/2+1),:); %Hz
length(freq)
length(fft(A_F))
%In this part I need help
A_fft=fft(g1); %without the conversion by 9.8 m/s^2
abs_A=abs(A_fft)
figure(4)
plot(freq,abs_A(1:length(freq)))
xlim([0 6]) % Because 5 Hz is 300 RPM
%ylim([-400 400])
xlabel('Frequency (Hz)')
ylabel('g')
%According to the practice in the laboratory the result is the following
%image.
This was my process to obtain the FFT, I would like to know if this process is correct?. Because when I plot this data is not the same values in y-axis that I had in the Dewesoft software.
Dewesoft fft(g) (attached) vs matlab fft(g) (attached)

Question #2
According to a Mechanical vibration book, I have the next equation to find the FRF. I applied this but my FRF y axis value is too high so, I don't know If I didn't applied correctly. That information is in my code and I use the following equation.

w= natural frequency = 31.42 rad/s^2.
I assumpted that A/F is g because according to the book, it says the next information: "Because the acceloremeter produces a voltage that is proportional to acceleration, we obtain the accelerance, A/F(w), from the dynamic signal analyzer".
My graph result:

This graph it doesn't have sense, because I need values aroun of 0.15-0.17 in the first vibration mode. So, I would like to know if there any suggestion how to resolve this.
Best Regards,
Jo98.
Réponse acceptée
Plus de réponses (2)
oybozkurt
le 5 Jan 2025
0 votes
Hello Mathieu,
I have been busy trying your programme for a long time, it is very good but I need your help with a few things. Firstly, in some cases it takes points very close to each other as 1st and 2nd mode. Secondly, is there a document you can recommend to understand the technical content of your programme?
7 commentaires
Mathieu NOE
le 6 Jan 2025
would you like to share your data and the code ? I can have a look and make suggestions. I have myself found that using modalfit options can be a bit tricky to get the correct results. Maybe I'll come with my own function some day
regarding publications, you can find a lot of publications on the internet regarding modal analysis, most of them will describe how time domain data are processed - here some suggestions (see also in attachment)
oybozkurt
le 6 Jan 2025
Thanks for your reply. I attach the 3 different data files and the code used (given by you). Some of the frequencies selected by the programme in these files are not compatible with the graph presented by the programme.
Also, as far as I understand from the programme, the damping coefficient is calculated with the half power method, is it possible for the programme to calculate it with log decrement at the same time? For the specimens used in the form of cantilever beam for the experiments, can the mode shapes be drawn if the impact hammer strike point and accelerometer position are entered?
Mathieu NOE
le 7 Jan 2025
hello again @oybozkurt
attached is a slightly modified version of my code. I simply used the "peak piking" method for modalfit here as the other options seems not to give the correct results - as you experienced.
the code also shows now the N (here N=2) identified modes as blue diamonds overlaid on the magnitude plot

Maybe modalfit is not the best code for the job, I was about to try with this instead : Rational Fraction Polynomial Method - File Exchange - MATLAB Central
the half power method works in frequency domain data , for multiple modes
the log decrement method works directly on time data but works only for one single dominant mode - you cannot separate multiple modes frequencies and damping values with this method
this code could be extended to multiple sensors responses ,and from there you could draw the mode shapes , but I am not there yet. The initial purpose was to simply demonstrate how we can generate the FRF data from multiple hits data, not to re-create an entire post processing tool (like many already available , like ABRAVIBE)
all the best
oybozkurt
le 13 Jan 2025
I just find a signalexpress software and I checked the graph of it with your code. There are some differences between them. Firstly, the magnitudes for vertical axis of frequency graph are different. Secondly, there is a difference on natural frequency and also it seems that differences are found between damping ratios. Could you comment on these? I want to be understand these.
Thank you
Mathieu NOE
le 13 Jan 2025
hello again
your excel file does not contain any hammer test data - can you provide the right file please ?
oybozkurt
le 13 Jan 2025
The sheet "Force" is from hammer.
Mathieu NOE
le 13 Jan 2025
oh yes indeed - I didn't see the excel file was different with more sheets :)
so I changed the code the load the correct sheets and also to display the magnitude plot now in dB as in signalexpress , I also did some changes for figure 3 display
the commented lines are the previous code version (y log scale) - the new code is magnitude converted in dB ref to the declared units.
then I opted for new modalfit parameters :
N = 1 ; % number of (dominant) modes to identify
FR = [5 300]; %
I see the same values of the dominant mode as in signalexpress (fn = 30 Hz, T = -34 dB ref 1 g/N)
T = 1×4 table
Mode Frequency Damping Gain (dB)
____ _________ _______ _________
1 30.028 0.12593 -33.616

Code updated in attachment
oybozkurt
le 13 Jan 2025
0 votes
Hello Mathieu,
First of all, thank you for your efforts. How accurately does the modalfit command work? When the graphs for ‘FitMethod’,‘lsrf’ and ‘FitMethod’,‘pp’ are carefully examined, the natural frequencies do not exactly coincide with the peaks, and there are significant differences between damping evaluated using ‘lsrf’ and ‘pp’ for the data I attached. Again, is the damping calculated by the method in the picture I attached or by another method.

14 commentaires
Mathieu NOE
le 13 Jan 2025
hehe, I have made the same observations as you. And either I am not using modalfit the correct way but I found a bit annoying to have such difficulties to make that function deliver what she's supposed to do
this publication Modal Analysis Using the Signal Processing Toolbox of Matlab 2017 shows also that that function gives different damping values depending on the method you selected , more or less in accordance with a "professionnal" grade software , so each method comes with its pro and cons and you need to try / find out what works best for you.
although the demo code provided by TMW seem to show that modalfit is capable of delivering good results (at least on the demo data), we have here a case where it seems to give unreliable results.
I have not too much used this function up to now , as I mostly focus on finding frequencies rather than the exact damping level (and therefore I did not use modalfit in the past) , but I agree with you, I was not really impressed with the results of modalfit, unless (again) there is something I did no see how to use it in a better way.
oybozkurt
le 13 Jan 2025
Hımm. What do you think about the frequency values (previously available in ms excel) presented by Signal Express software during the experiment? How can you calculate natural frequency and damping using these values?
oybozkurt
le 13 Jan 2025
I meant without using modalfit.
Mathieu NOE
le 13 Jan 2025
So I tried to get some info's about how modalfit works but the editable code does not really help me
fortunately other people have done more investigations than me and here comes back some tips :

PP (peak picking or peak amplitude as described in the picture) method is fine in our case as it's used for SISO systems - it's simple , fast and usually gives fairly good results. It's the same as the "-3 dB" method you showed in your picture above
other methods like LSCE and LSRF are intended to be used for SIMO or MIMO systems , so not really our job here , but I have to read again carefully those publications to see if there is anything that speaks again for a SISO case. I prefer not to say something wrong now.
this is also an interesting publication in attachment
maybe it's time I need to create my own modalfit function :)
Mathieu NOE
le 13 Jan 2025
forgot to say that there are some info's on the help page of modal fit
but here I see some differences between how mathworks implemented the PP method vs how it's described in the litterature - seems there is more than one way to define PP method
Mathieu NOE
le 14 Jan 2025
hello again @oybozkurt
finally I tried to replace modalfit with my own version the peak picking / - 3 dB bandwith algorithm
and I performed some comparisons between the code with modalfit vs my own code
attached find all the code versions + one new function peakfinder (using it as alternative to findpeaks for faster execution - can be downloaded from Fex : peakfinder(x0, sel, thresh, extrema, includeEndpoints, interpolate) - File Exchange - MATLAB Central or simply copy the attached file in your path)
summary of codes with modalfit :
- Modal_Analysis_FRF_computationP0.m : to be used with data file Pr1.xlsx,Pr2.xlsx,etc...
- Modal_Analysis_FRF_computationT0.m : to be used with data file Test.xlsx
summary of codes with my own modal extraction :
- Modal_Analysis_FRF_computationP1.m : to be used with data file Pr1.xlsx,Pr2.xlsx,etc..
- Modal_Analysis_FRF_computationT1.m : to be used with data file Test.xlsx
And my results so far : (with my own code I got better frequency accuracy and the damping values are matching modalfit results when using the pp option) :
>> Modal_Analysis_FRF_computationP0 (with modal fit)
filename = "Pr1.xlsx";
Mode Frequency Damping
____ _________ ________
1 35.121 0.013558
2 286.1 0.011218
>> Modal_Analysis_FRF_computationP1 (my own peak picking / -3dB algo)
filename = "Pr1.xlsx";
Mode Frequency Damping Gain (dB)
____ _________ ________ _________
1 35.149 0.015418 -22.365
2 286.01 0.011156 -12.514
3 320.5 0.012275 -23.44
Modal_Analysis_FRF_computationT0 (with modal fit)
filename = "Test.xlsx";
Mode Frequency Damping
____ _________ _______
1 30.028 0.12593
2 200.61 0.19108
Modal_Analysis_FRF_computationT1 (my own peak picking / -3dB algo)
filename = "Test.xlsx";
Mode Frequency Damping Gain (dB)
____ _________ _______ _________
1 29.49 0.12159 -33.526
oybozkurt
le 14 Jan 2025
Thank you. I prepared an MS Excel file to evaluate natural frequency and damping ratio using FRF data taken from Signal Express. I applied an equivalent command to peakfinder(max) to perform -3dB bandwidth algorithm. I will compare your codes results with my Excel file results.
Mathieu NOE
le 15 Jan 2025
Just fyi
as we have now a code that works , it's time to make the script shorter and better looking. So the "heavy lifting" is done by functions and the main script is now much lighter and readable.
functions are :
dotheFFT.m : basically to go from the time records to the FRF
find_zc.m : zero crossing detection in signals (used indotheFFT.m)
peak_picking_results.m : extract modal parameters from FRFs (peak picking algorithm)
Jo98
le 14 Mar 2025
Mathieu NOE
le 14 Mar 2025
hello @Jo98
let's try - what is the question ?
Jo98
le 15 Mar 2025
Mathieu NOE
le 17 Mar 2025
hello again
I know SLD because I read quite a lot of publications about machining / chatter issues , but I don't realize SLD computations or predictions myself because that is more the problem of the consultant or tool suppliers or the machine designer.
I define my role as a supplier of damping systems that will improve the milling machine performance - in attachment you see the active damping system we have designed that allows usually +200% performance in rough milling.
I do not have the book you are mentionning , but maybe I can get it somehow.
Is your question related about if your code does exactly follow the book, I will be unable to tell right now as I don't have the book.
Jo98
le 22 Mar 2025
Mathieu NOE
le 24 Mar 2025
ok - all the best for the future !
Catégories
En savoir plus sur Vibration Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


