You will fit a sine to 60 noisy readings of a swinging spring, with a first guess from the FFT.
The idea. The FFT finds the main frequency to within one bar. curve_fit then refines the amplitude, the frequency and the phase, and pcov gives the errors.
Your tasks.
model(t, A, f, phi): the sine .guess to the frequency of the tallest bar of the FFT, in Hz.curve_fit, starting from [1.0, guess, 0.0]. Set f_fit to the fitted frequency and f_err to its error.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…