Solution Review: Fitting a Wave

This lesson discusses the solution to the fitting a wave problem.

We'll cover the following

Solution

Inserting the data below:

(t0,y0)=(0.25,3)(t_0, y_0)=(0.25, 3)

(t1,y1)=(0.5,2)(t_1, y_1)=(0.5, 2)

(t2,y2)=(0.75,3)(t_2, y_2)=(0.75, -3)

(t3,y3)=(1,0)(t_3, y_3)=(1, 0)

in the equation

y=a sin(πt)+b sin(2πt)+c sin(3πt)+d sin(4πt)y=a\space sin(\pi t)+b\space sin(2\pi t)+c\space sin(3\pi t)+d\space sin(4\pi t)

gives the following system of equations

[12112010101211200000][abcd]=[3230]\begin{bmatrix}\frac{1}{\sqrt{2}} & 1 & \frac{1}{\sqrt{2}} & 0 \\1 & 0 & -1 & 0 \\\frac{1}{\sqrt{2}} & -1 & \frac{1}{\sqrt{2}} & 0 \\ 0 & 0 & 0& 0\\ \end{bmatrix}\begin{bmatrix}a \\ b \\ c \\d \end{bmatrix}= \begin{bmatrix}3 \\ 2 \\ -3 \\0 \end{bmatrix}

Now let’s implement it in Python and solve it.

Get hands-on with 1400+ tech skills courses.