Dicrepancies in FFT values at lower frequencies

I have been trying to compare the time domain and frequency domain results from Matlab and ansys for a vibrating system. Although the values agree generally, at lower frequencies there appears to be a significant difference.Especially at 0, the amplitude varies significantly (in the time domain data,at time 0, both systems had the same amplitude). Why would that be? I have exported data from excel sheet for this analysis.
%Import time domain data from excel sheet
file = '....nt.xlsx';
sheet= '...';
data = xlsread(file,sheet);
time = data(:,1);
mat_amp = data(:,2);
ans_amp= data(:,3);
%% Frequency domain plot
L = length(time);
n=2^nextpow2(L);
Ts = time(2)-time(1);
Fs = 1/Ts;
f= Fs*(0:(n/2))/n;
ft_mat = fft(mat_amp,n);
M2 = abs(ft_mat/n);
M1 = M2(1:n/2+1);
M1(2:end-1)=2*M1(2:end-1);
ft_ans = fft(ans_amp,n);
A2 = abs(ft_ans/n);
A1 = A2(1:n/2+1);
A1(2:end-1)=2*A1(2:end-1);
figure(2)
plot(f,abs(M1),'-*',f,abs(A1)) ;
title("Frequency Response-Beam with Mass")
xlabel("f (Hz)")
ylabel("Amplitude")
grid on;
legend('Matlab', 'Ansys');
figure(3)
plot(f,20*log10(abs(M1)),'-*',f,20*log10(abs(A1)));
title("Frequency Response-Beam with Mass")
xlabel("f (Hz)")
ylabel("Amplitude in dB")
grid on;
legend('Matlab', 'Ansys');

10 Comments

Assuming that we're looking at figure(3) as generated from the code in the question, it would seem that mat_amp and ans_amp are not the same data. Is that not the case?
Also, should ft_mat and ft_ans be divided by n or L?
Hello Paul,mat_amp an d ans_amp are the time domain data obtanied from a transient vibration analysis of a same system conducted in matlab and ansys.
At time 0, both systems had the same amplitude ideally. So when converting to frequency domain, shouldn't I be getting same magnitude for both at frequency 0??
I tried dividing with L and n, there wasnt any change in the result.
hello
I don't know how the time domain data look like , but in general I compare systems based on transfer function estimates and no only on the response , which can sometimes led to inaccurate results like in your case
so can you perform the same comparison using tfestimate (with both input and output data) and not just the fft of the output ?
Hello Mathieu,
All I have is the amplitude vs time data from matlab and ansys. Discrepancies can be justifies as analytical model and finite element model are different. My concern here is the amplitude at frequency 0. I deally shouldn`t bothz the curves start at the same point in Y axis, or is there some logical misunderstanding.
As you showed below, you're taking the FFT of two different signals, so it's not a surprise that their FFT's are not the same. You're doing something different in Matlab and Ansys in how the time-domain data is generated from each tool.
The ampiitude of a signal at t = 0 is not directly related to the FFT amplitude at f = 0. The latter is proportional to the sum of all of the samples input to fft.
The issue with the division by L or n is only to get the correct amplitude at all frequencies, but won't change the fundamental nature of the frequency domain plot.
Thanks a lot Paul. I followed a few tutorials for this code. Frankly speaking I still dont have a complete understanding of the logic of some steps. I referred matlab help too. It would be a great help if you can share any materials ot links that you have to have a better understanding of the conversion.
if your time data are impulse or step responses you can take advantage of knowing that info
I would recommend to use that data + info to identify a lightly damped two poles model , which should give you more accurate response plot vs simply doing the fft
and if you go that route , you can also use this code to find the natural frequency and damping of your 2 poles model
you can do this directly on your time data :
n = 1000;
Fs = 1e3; % sampling rate
dt = 1/Fs;
% dummy signal : exponential decaying sinus + constant
t = (0:n-1)*dt;
s = 5 + exp(-1.6*t).*sin(2*pi*3.3*t+1)+0.01*randn(size(t));
yu = max(s);
yl = min(s);
yr = (yu-yl); % Range of y
yz = s-yu+(yr/2);
zt = t(yz(:) .* circshift(yz(:),[1 0]) <= 0); % Find zero-crossings
per = 2*mean(diff(zt)); % Estimate period
ym = mean(s); % Estimate offset
fit = @(b,x) b(1) .* exp(b(2).*x) .* (sin(2*pi*x./b(3) + 2*pi/b(4))) + b(5); % Objective Function to fit
fcn = @(b) norm(fit(b,t) - s); % Least-Squares cost function
B = fminsearch(fcn, [yr; -1; per; -1; ym]) % Minimise Least-Squares
B = 5×1
1.0002 -1.5987 0.3030 -1.1889 5.0001
xp = linspace(min(t),max(t));
yp = fit(B,xp);
figure
plot(t, s, '-p',xp, yp, '-r')

Sign in to comment.

Answers (0)

Products

Release

R2023a

Asked:

on 22 Nov 2023

Commented:

on 27 Nov 2023

Community Treasure Hunt

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

Start Hunting!