Prepare Fourier Amplitude Spectrum from ground motion record (Peak-Acceleration vs time-period)
1 view (last 30 days)
Show older comments
Prepare Fourier Amplitude Spectrum from ground motion record (Peak-Acceleration vs time-period) with the input .txt files which contains peak-acceleration in 1st column & time-period in 2nd column.
0 Comments
Answers (1)
Star Strider
on 24 Apr 2024
Perhaps this —
T1 = readtable('india.19911019...at_output.txt');
T1.Properties.VariableNames = {'Peak Acceleration','Time'}
[FTs1,Fv] = FFT1(T1.('Peak Acceleration'),T1.Time);
[PeakVal,idx] = max(abs(FTs1)*2);
fprintf('\nMaximum acceleration of about %.4f mm/s^2 occurs at about %0.4f Hz\n', PeakVal, Fv(idx))
figure
plot(Fv, abs(FTs1)*2)
grid
xlabel('Frequency')
ylabel('Magnitude')
function [FTs1,Fv] = FFT1(s,t)
t = t(:);
L = numel(t);
if size(s,2) == L
s = s.';
end
Fs = 1/mean(diff(t));
Fn = Fs/2;
NFFT = 2^nextpow2(L);
FTs = fft((s - mean(s)) .* hann(L).*ones(1,size(s,2)), NFFT)/sum(hann(L));
Fv = Fs*(0:(NFFT/2))/NFFT;
% Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
FTs1 = FTs(Iv,:);
end
Experiment!
.
4 Comments
Star Strider
on 27 Apr 2024
My pleasure!
I would not say that the response is completely different, however your non-MATLAB software gives a different magnitude result than my MATLAB code.
Taking ths of that result gives —
SeismoSignalVal = log10(1.4939)
MyCode = 10^(0.0585)
These are not strictly comparable, however they are reasonably close. I am not certain what the ‘SeismoSignal’ code does, or how it produces its Fourier transform results. It also appears to use a 25 Hz lowpass filter prior to calculating the Fourier transform, since there is no energy higher than that in the ‘SeismoSignal’ record. I did not use any filters in my code.
Also, the ‘SeismoSignal’ Bode magnitude plot uses a truncated logarithmic frequency axis. (I have reproduced that here.) My plot uses a simple linear frequency axis.
For all intents and purposes, the ‘SeismoSignal’ result and my result are the same.
My analysis —
figure
imshow(imread('Screenshot 202...27 092404.png'))
title('Image of the ‘SeismoSignal’ Fourier Magnitude Plot')
T2 = readtable('FAS_Ordinates.xlsx', 'VariableNamingRule','preserve')
VN2 = T2.Properties.VariableNames;
figure
plot(T2.Frequency, T2.('Fourier Amplitude'))
grid
xlabel(VN2{1})
ylabel(VN2{3})
title('Linear Frequency Axis')
[PeakVal,idx] = max(T2.('Fourier Amplitude'));
fprintf('\nMaximum acceleration of about %.4f mm/s^2 occurs at about %0.4f Hz\n', PeakVal, T2.Frequency(idx))
figure
semilogx(T2.Frequency, T2.('Fourier Amplitude'))
grid
xlabel(VN2{1})
ylabel(VN2{3})
title('Logarithmic Frequency Axis')
figure
semilogx(T2.Frequency, T2.('Fourier Amplitude'))
grid
xlabel(VN2{1})
ylabel(VN2{3})
xlim([1 max(T2.Frequency)])
title('Truncated Logarithmic Frequency Axis')
.
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!