I am simulating the displacement as a function of time of an elastic body subject to a chirped sinusoidal force. The force chirps linearly from 0 Hz to 10 Hz over 10 seconds. The result of the simulation is displacement as a function of time, sampled at 1000 Hz. Data is available at this google sheets link.
The chirped sinusoidal force is given by $$ F(t) = A \left( 1 - \cos\left(2 \pi \left( \frac{c}{2}t^2\right) \right)\right), $$ where $c = 10\,\mathrm{Hz/s}$ and $A$ is an arbitrary amplitude constant.
The displacement as a function of time shown below (Image 1) has a peak amplitude at about 2.4 s, which corresponds to a frequency of 24 Hz. However, when taking the fast Fourier transform (my code is given at the bottom), a clear peak emerges at 21.5 Hz (Image 2).
Is this likely the result of a mistake in my data analysis approach, or is there a mathematical reason why the maximum displacement might not line up with the peak in the spectrum?
Image 1: Displacement as a function of time
Image 2: Displacement as a function of frequency
FFT Code
dt = time(2)-time(1); %Calculate the time step
Fs = 1/dt; %Calculate the sampling frequency
Y = fft(dispdata); %Take Fast Fourier Transform
L = length(dispdata); %Find length of the input data
P2 = abs(Y/L); %Compute the 2-sided spectrum
P1 = P2(1:L/2+1); %compute the single-sided spectrum P1 based on P2 and the even-valued signal length L
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L; %Compute the frequency domain


Just figured it out. The frequency according to the equation above is $f = \frac{c}{2} t^2$. This makes the chirp linear in frequency, but not linear in time! You can't simply get the frequency of the peak displacement by multiplying the time by 10! I will trust the Fourier transform.