Write an algorithm that selects the $K$ peaks from an $N$-point DFT magnitude spectrum $(K<N)$. Assume that the $K$ spectral peaks are associated with pure tones in the input signal, $s(n)$. Design a sinusoidal analysissynthesis model that minimizes the MSE, $\varepsilon$,
$$
\varepsilon=\sum_n e^2(n)=\sum_n\left[s(n)-\sum_{k=1}^K A_k \cos \left(\omega_k n+\phi_k\right)\right]^2,
$$
where $s(n)$ is the input speech, $A_k$ represents the amplitude, $\omega_k$ represents the frequency, and $\phi_k$ denotes the phase of the $k$-th sinusoid. Hint: Refer to [McAu86].