/ proof-of-concept / plate-dynamics-lab-2
Sign in
proof-of-concept / plate-dynamics-lab-2
plate-dynamics-lab-2 / packages / core / src / m / plate_spectrum.m
19 lines · 672 BCodeBlameHistory
2% PLATE_SPECTRUM One-sided amplitude spectrum of a real, uniformly sampled signal.
3%
4% [f, A] = plate_spectrum(t, x) applies a Hann window and returns the
5% amplitude A at frequencies f [Hz], scaled so that a steady sinusoid of
6% amplitude a shows a peak of height about a. For a decaying signal the
7% peak heights depend on the record length, so compare shapes and
8% frequencies rather than absolute heights.
10x = x(:).';
11N = numel(x);
12dt = t(2) - t(1);
13win = 0.5 * (1 - cos(2 * pi * (0:N - 1) / (N - 1)));
14X = fft(x .* win);
15nh = floor(N / 2) + 1;
16X = X(1:nh);
17A = abs(X) * 2 / sum(win);
18f = (0:nh - 1) / (N * dt);
19end
↑↓ move↵openescclose