response spectrum - time domain to frequency domain

2 views (last 30 days)
Hi all, hope this message finds you well. I have been running tests on a model wind turbine using fast and have an example of the output data in the time domain as shown below.
Time RotSpeed
(s) (rpm)
0 12.10
0.0125 12.11
0.025 12.11
0.0375 12.11
0.05 12.09
0.0625 12.07
0.075 12.03
I need a response spectrum to find natural frequencies etc. If anyone could give me any advice it would be really appreciated.
Kind regards,
Tom

Answers (1)

Star Strider
Star Strider on 4 Apr 2020
Here is some example code that you can adapt to your data:
t = linspace(0, 5, 1E+4); % Time Vector
s = sum(sin([100; 250; 300; 700]*2*pi*t)); % Signal Vector
figure
plot(t, s)
grid
L = numel(t); % Signal Length
Ts = mean(diff(t)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
n = nextpow2(numel(t)); % Zero-Pad So Length Is The Next Highest Power Of 2 (Not Required)
FTs = fft(s,2^n)/L; % Discrete Fourier Transform
Fv = linspace(0, 1, fix(2^n/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure
plot(Fv, abs(FTs(Iv))*2)
grid
If you do not use nextpow2, the fft call becomes:
FTs = fft(s)/L;
and the frequency vector calculation becomes:
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
The rest of the code is unchanged.

Community Treasure Hunt

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

Start Hunting!