IFFT function doesn't work for modified fourer spectras

54 vues (au cours des 30 derniers jours)
Zorbey
Zorbey le 5 Déc 2024 à 17:34
Commenté : Walter Roberson le 6 Déc 2024 à 5:51
I am trying to perform linear site response analysis using Matlab. I have imported Loma Prieta Earthquake acceleration record as a one-column matrix as txt. file (Gilroy.txt) and after i defined time/frequency steps/boundaries, I performed fft to record. After that, I defined the transfer function as FW and multiplied it with created fourier spectra. In the last part, I performed ifft command to the modified spectra, but the ifft function did not work, but when i tried the ifft of the first created spectra, it worked correctly and plotted the first acc-time hsitory. After i tried for different examples, the ifft function works only variables which equals to fft(any series), it doesn't work for any other modified or manually inputed values. I share my code and txt file, appreciate for your helps.
%site response analysis for
%undamped soil case / linear elastic analysis
%ground motion data input
load Gilroy1.txt
[nt,j]=size(Gilroy1);
%soil data input
H=3.05;
V=320;
%arrays
T=(nt-1)/200; dt=T/(nt-1); df=1/T;
fmax=(nt/2)*df; t0=0:dt:(nt-1)*dt;
f0=0:df:(nt-1)*df;
f_half=0:df:(round(nt/2)-1)*df;y=Gilroy1*9.81;
%FFT
Y=fft(y); Y1=abs(Y);
Y_half=zeros(1,round(nt/2));
Y_half(1:round(nt/2))=Y(1:round(nt/2));
Y1_half=zeros(1,round(nt/2));
Y1_half(1:round(nt/2))=Y1(1:round(nt/2));
%transfer function
FW=1./(cos(2*pi*f0*H/V));
FW1=1./abs(cos(2*pi*f0*H/V));
%ground motion
YY1=Y.*FW';
data1=ifft(YY1);
%plotting
figure(1);plot(t0,y);grid on
xlabel('time (s)');ylabel('a (m/sn^2)')
title('bedrock motion')
figure(2);plot(f_half,Y1_half);grid on
xlabel('Hz');ylabel('amplitude spectrum')
title('frequency content')
figure(3);plot(t0,data1);grid on
Warning: Imaginary parts of complex X and/or Y arguments ignored.
xlabel('time (s)');ylabel('a (m/sn^2)')
title('ground motion')

Réponses (1)

Walter Roberson
Walter Roberson le 5 Déc 2024 à 22:07
[nt,j]=size(Gilroy1);
%...
f0=0:df:(nt-1)*df;
%...
Y=fft(y); Y1=abs(Y);
%...
FW=1./(cos(2*pi*f0*H/V));
%...
YY1=Y.*FW';
data1=ifft(YY1);
Your Y is built around the fft of the input data. So your Y is frequency domain. The input data is all real-valued, so the two-sided fft will have the results for the positive frequencies followed by the results for the negative frequencies, and the results for the negative frequencies will be the flip() of the complex conjugate of the results for the positive frequencies. In order for the ifft() of anything to return real-valued results, this structure of "constant" followed by "positive frequencies" followed by "flip of complex conjugate of positive frequencies" must be preserved.
Your f0 is a time vector that relates time to the entire set of samples.
Your FW works with f0 so your FW is based upon time for the entire set of samples.
You then construct
YY1=Y.*FW';
which multiplies frequency data by values constructed by time series. Even assuming that the result of multiplying frequency data by time data is meaningful, the time data does not have the structure of 0-positive-negative. So the result YY1 does not have the structure of 0-positive-negative. But 0-positive-negative is needed in order for ifft() to return real-valued results. So the ifft(YY1) cannot turn out to be real-valued.
  2 commentaires
Zorbey
Zorbey le 6 Déc 2024 à 5:17
Thank you sir for the explanations. In order to perform linear site response analysis, the fourier amplitude spectra is multiplied with transfer function (FW) and then the ifft is apllied to obtain the acc-time history at ground surface by definition. But when I consider your explanation, is it a way that I could perform it on Matlab by changing my script, I would appreciate for your help.
Walter Roberson
Walter Roberson le 6 Déc 2024 à 5:51
Well, I would point out that the transfer function is not based on time: transfer functions are based on frequency.
The first example in the fft documentation shows construction of the frequency vector as the base for the complex magnitude plot. It is probably easier to work with fftshift(), do the calculation, and then fftshift() back.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Vibration Analysis dans Help Center et File Exchange

Produits


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by