IFFT function doesn't work for modified fourer spectras
54 ビュー (過去 30 日間)
古いコメントを表示
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
xlabel('time (s)');ylabel('a (m/sn^2)')
title('ground motion')
0 件のコメント
回答 (1 件)
Walter Roberson
2024 年 12 月 5 日 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 件のコメント
Walter Roberson
2024 年 12 月 6 日 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.
参考
カテゴリ
Help Center および File Exchange で Vibration Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!