function [f, A] = plate_spectrum(t, x) % PLATE_SPECTRUM One-sided amplitude spectrum of a real, uniformly sampled signal. % % [f, A] = plate_spectrum(t, x) applies a Hann window and returns the % amplitude A at frequencies f [Hz], scaled so that a steady sinusoid of % amplitude a shows a peak of height about a. For a decaying signal the % peak heights depend on the record length, so compare shapes and % frequencies rather than absolute heights. x = x(:).'; N = numel(x); dt = t(2) - t(1); win = 0.5 * (1 - cos(2 * pi * (0:N - 1) / (N - 1))); X = fft(x .* win); nh = floor(N / 2) + 1; X = X(1:nh); A = abs(X) * 2 / sum(win); f = (0:nh - 1) / (N * dt); end