Scaling problem from Fourier continuous transformate via IFFT

2 vues (au cours des 30 derniers jours)
David
David le 26 Avr 2015
Dear mates,
I am having a problem comparing the impulse response of a system calculated through impulse() with the one obtained by applying ifft to a theorical fourier transformate evaluated in N points. I am getting an error between maximums of the order of 1000. I attach the code, hope someone could bring some light on this:
%%Variable initialization
syms w
s = tf('s');
sh = 0.01;
Ts = 0.001; % sampling period
Fs = 1/Ts; % sampling frequency
nElementos = 2^16; % Number of elementos for ifft
%%System parameters
% masa suspendida
ms=175;ks=200000;cs=40000;
l0muelle=90; % longitud inicial del muelle en mm
RH0=45; % Altura al suelo en reposo del vehiculo en mm
% masa no suspendida
mu=20;ku=200000;cu=1;
l0neumatico=30; % longitud inicial del neumatico en mm
%%System characterization via Laplace transformate applied to Diff Eqs
% System
t11=(ms*(s^2)+cs*s+ks);
t12=(-cs*s-ks);
t21=t12/(s*cu+ku);
t22=(mu*(s^2)+(cs+cu)*s+(ks+ku))/(s*cu+ku);
T=[t11,t12;t21,t22];
M=T^-1;
X=M*[0;1];
Xu=X(2);
t = linspace(0,20,20000);
%%Sprung Mass impulse response
% [y,t]=step(sh*Xs,t);
y = impulse(Xu,t);
yf1=1000*y; % Scaling to mm
hy=plot(t,yf1,'b');
hold on;
title('Time Response')
xlabel('Time (s)') % x-axis label
ylabel('Ride Height Sprung Mass (mm)') % y-axis label
%%System characterization via Fourier transformate (substituing s=jw in Laplace transf)
t11=(ms*((1i*w)^2)+cs*1i*w+ks);
t12=(-cs*1i*w-ks);
t21=t12/(1i*w*cu+ku);
t22=(mu*((1i*w)^2)+(cs+cu)*1i*w+(ks+ku))/(1i*w*cu+ku);
T=[t11,t12;t21,t22];
M=T^-1;
X=M*[0;1];
Xu=X(2);
wdiscreta = 2*pi*Fs*linspace(0,1,nElementos); % angular velocity vector
XuDiscreta = double(subs(Xu, w, wdiscreta))*Ts; % substituing w in continuous fourier transformate
xUFFT = ifft(XuDiscreta, nElementos)/Ts; % Applying ifft
yf=1000*(xUFFT); % Scaling to mm
plot(linspace(0,length(xUFFT)*Ts,length(xUFFT)), real(yf),'r')
error = (max(real(yf))-max(yf1))/max(yf1) % Compute error for comparison purposes
max(real(yf1))/max(real(yf)) % Maximums cocient
plot(linspace(0,length(xUFFT)*Ts,length(xUFFT)), (max(yf1)/max(yf))*real(yf),'g')

Réponses (1)

Ahmet Cecen
Ahmet Cecen le 26 Avr 2015
Just a quick thought without inspecting the code, so this might not be the case, or the only problem: Check if the signal from the one approach has the same sampling rate as the other, since fft will ensure the average over all sampling points is maintained. So if 1 approach is computed over 1000 points, while the other over 5000, you can see that kind of scaling error.

Catégories

En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by