|
|
Line 35: |
Line 35: |
|
| |
|
|
| |
|
| in matrix form (7 harmonics). '''Note:''' all instances of <math>\sum</math> are actually <math>\sum_{i=1}^M</math> | | in matrix form (N harmonics). '''Note:''' all instances of <math>\sum</math> are actually <math>\sum_{i=1}^M</math> where M is the number of time-steps in the time-averaging window. |
|
| |
|
| :<math>\begin{array}{cccc} | | :<math>\begin{array}{cccc} |
| \left[ \begin{array} {cccccc} | | \left[ \begin{array} {cccccc} |
| \\ | | \\ |
| M & {\color{Blue}\sum \sin\omega_1 t_i} & {\color{Blue}\sum \sin\omega_2 t_i} | | M & \sum \sin\omega_1 t_i & \sum \sin\omega_2 t_i |
| & \cdots & \sum \cos\omega_1 t_i & \cdots \\ | | & \cdots & \sum \cos\omega_1 t_i & \cdots \\ |
| \\ | | \\ |
| {\color{Blue}\sum \sin\omega_1 t_i} & {\color{Blue}\sum \sin^2 \omega_1 t_i} & \sum \sin\omega_2 t_i \sin\omega_1 t_i
| | \sum \sin\omega_1 t_i & \sum \sin^2 \omega_1 t_i & \sum \sin\omega_2 t_i \sin\omega_1 t_i |
| & \cdots & \sum \cos\omega_1 t_i \sin\omega_1 t_i & \cdots \\ | | & \cdots & \sum \cos\omega_1 t_i \sin\omega_1 t_i & \cdots \\ |
| \\ | | \\ |
| {\color{Blue}\sum \sin\omega_2 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \sin\omega_2 t_i} & {\color{Blue}\sum \sin^2 \omega_2 t_i}
| | \sum \sin\omega_2 t_i & \sum \sin\omega_1 t_i \sin\omega_2 t_i & \sum \sin^2 \omega_2 t_i |
| & \cdots & \sum \cos\omega_1 t_i \sin\omega_2 t_i & \cdots \\ | | & \cdots & \sum \cos\omega_1 t_i \sin\omega_2 t_i & \cdots \\ |
| \\ | | \\ |
| {\color{Blue}\vdots} & {\color{Blue}\vdots} & \cdots & \cdots & \cdots & \cdots \\
| | \vdots & \vdots & \cdots & \cdots & \cdots & \cdots \\ |
| \\ | | \\ |
| {\color{Blue}\sum \sin\omega_7 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \sin\omega_7 t_i} & {\color{Blue}\sum \sin\omega_2 t_i \sin\omega_7 t_i}
| | \sum \sin\omega_7 t_i & \sum \sin\omega_1 t_i \sin\omega_7 t_i & \sum \sin\omega_2 t_i \sin\omega_7 t_i |
| & \cdots & \sum \cos\omega_1 t_i \sin\omega_7 t_i & \cdots \\ | | & \cdots & \sum \cos\omega_1 t_i \sin\omega_7 t_i & \cdots \\ |
| \\ | | \\ |
| {\color{Blue}\sum \sin\omega_1 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \cos\omega_1 t_i} & {\color{Blue}\sum \sin\omega_2 t_i \cos\omega_1 t_i}
| | \sum \sin\omega_1 t_i & \sum \sin\omega_1 t_i \cos\omega_1 t_i & \sum \sin\omega_2 t_i \cos\omega_1 t_i |
| & \cdots & \sum \cos^2 \omega_1 t_i & \cdots \\ | | & \cdots & \sum \cos^2 \omega_1 t_i & \cdots \\ |
| \\ | | \\ |
| {\color{Blue}\sum \cos\omega_2 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \cos\omega_2 t_i} & {\color{Blue}\sum} \sin\omega_2 t_i \cos\omega_2 t_i
| | \sum \cos\omega_2 t_i & \sum \sin\omega_1 t_i \cos\omega_2 t_i & \sum \sin\omega_2 t_i \cos\omega_2 t_i |
| & \cdots & \sum \cos\omega_1 t_i \cos\omega_2 t_i & \cdots \\ | | & \cdots & \sum \cos\omega_1 t_i \cos\omega_2 t_i & \cdots \\ |
| \\ | | \\ |
| {\color{Blue}\vdots} & {\color{Blue}\vdots} & \vdots & \vdots & \vdots & \vdots \\
| | \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ |
| \\ | | \\ |
| {\color{Blue}\sum \cos\omega_7 t_i} & {\color{Blue}\sum \sin\omega_1 t_i \cos\omega_7 t_i} & \sum \sin\omega_2 t_2 \cos\omega_7 t_i
| | \sum \cos\omega_7 t_i & \sum \sin\omega_1 t_i \cos\omega_7 t_i & \sum \sin\omega_2 t_2 \cos\omega_7 t_i |
| & \cdots & \sum \cos\omega_1 t_i \cos\omega_7 t_i & \cdots \\ \\ | | & \cdots & \sum \cos\omega_1 t_i \cos\omega_7 t_i & \cdots \\ \\ |
| \end{array} \right] & | | \end{array} \right] & |
Least Squares Fit for ROMS Tides
: state variables
: tidal frequency
: amplitude
: number of harmonics
To minimize cost function
![{\displaystyle \varepsilon ^{2}={\frac {1}{T}}\int _{t_{1}}^{t_{2}}\left[\phi -\left({\bar {\phi }}+\sum _{k=1}^{N}(A_{k}\sin \omega _{k}t)+\sum _{k=1}^{N}(B_{k}\cos \omega _{k}t)\right)\right]^{2}dt}](https://www.myroms.org/www.myroms.org/v1/media/math/render/svg/88b925fac9c93af7318d2388c9c8bfc4a1dfdfe4)
are unknowns
In discrete space:
![{\displaystyle \varepsilon ^{2}={\frac {1}{M}}\sum _{i=1}^{M}\left[\phi _{i}-\left({\bar {\phi }}+\sum _{k=1}^{N}(A_{k}\sin \omega _{k}t_{i})+\sum _{k=1}^{N}(B_{k}\cos \omega _{k}t_{i})\right)\right]^{2}}](https://www.myroms.org/www.myroms.org/v1/media/math/render/svg/d7f837b181de1f261eb42f49d06dba7bc3602ce6)
at the minimum



![{\displaystyle \sum _{i=1}^{M}\left[-2\phi _{i}+2{\bar {\phi }}+2\sum _{k=1}^{N}(A_{k}\sin \omega _{k}t_{i})+2\sum _{k=1}^{N}(B_{k}\sin \omega _{k}t_{i})\right]=0}](https://www.myroms.org/www.myroms.org/v1/media/math/render/svg/78315921da3c1c581ab53b637d2fe570464dfe30)
![{\displaystyle {\begin{aligned}\sum _{i=1}^{M}{\Bigg [}&-2\phi _{i}\sin \omega _{k}t_{i}+2{\bar {\phi }}\sin \omega _{k}t_{i}+2\sum _{p=1}^{N}(A_{p}\sin \omega _{p}t_{i}\sin \omega _{k}t_{i})\\&+2\sum _{p=1}^{N}(B_{p}\cos \omega _{p}t_{i}\sin \omega _{k}t_{i}){\Bigg ]}=0\end{aligned}}}](https://www.myroms.org/www.myroms.org/v1/media/math/render/svg/1d90926f17a7d50872c7333983d9c8e5db9a83c9)
![{\displaystyle {\begin{aligned}\sum _{i=1}^{M}{\Bigg [}&-2\phi _{i}\cos \omega _{k}t_{i}+2{\bar {\phi }}\cos \omega _{k}t_{i}+2\sum _{p=1}^{N}(A_{p}\sin \omega _{p}t_{i}\cos \omega _{k}t_{i})\\&+2\sum _{p=1}^{N}(B_{p}\cos \omega _{p}t_{i}\cos \omega _{k}t_{i}){\Bigg ]}=0\end{aligned}}}](https://www.myroms.org/www.myroms.org/v1/media/math/render/svg/5f1f0e9b180310865ca46045ee0289f5b5fce442)
in matrix form (N harmonics). Note: all instances of
are actually
where M is the number of time-steps in the time-averaging window.
![{\displaystyle {\begin{array}{cccc}\left[{\begin{array}{cccccc}\\M&\sum \sin \omega _{1}t_{i}&\sum \sin \omega _{2}t_{i}&\cdots &\sum \cos \omega _{1}t_{i}&\cdots \\\\\sum \sin \omega _{1}t_{i}&\sum \sin ^{2}\omega _{1}t_{i}&\sum \sin \omega _{2}t_{i}\sin \omega _{1}t_{i}&\cdots &\sum \cos \omega _{1}t_{i}\sin \omega _{1}t_{i}&\cdots \\\\\sum \sin \omega _{2}t_{i}&\sum \sin \omega _{1}t_{i}\sin \omega _{2}t_{i}&\sum \sin ^{2}\omega _{2}t_{i}&\cdots &\sum \cos \omega _{1}t_{i}\sin \omega _{2}t_{i}&\cdots \\\\\vdots &\vdots &\cdots &\cdots &\cdots &\cdots \\\\\sum \sin \omega _{7}t_{i}&\sum \sin \omega _{1}t_{i}\sin \omega _{7}t_{i}&\sum \sin \omega _{2}t_{i}\sin \omega _{7}t_{i}&\cdots &\sum \cos \omega _{1}t_{i}\sin \omega _{7}t_{i}&\cdots \\\\\sum \sin \omega _{1}t_{i}&\sum \sin \omega _{1}t_{i}\cos \omega _{1}t_{i}&\sum \sin \omega _{2}t_{i}\cos \omega _{1}t_{i}&\cdots &\sum \cos ^{2}\omega _{1}t_{i}&\cdots \\\\\sum \cos \omega _{2}t_{i}&\sum \sin \omega _{1}t_{i}\cos \omega _{2}t_{i}&\sum \sin \omega _{2}t_{i}\cos \omega _{2}t_{i}&\cdots &\sum \cos \omega _{1}t_{i}\cos \omega _{2}t_{i}&\cdots \\\\\vdots &\vdots &\vdots &\vdots &\vdots &\vdots \\\\\sum \cos \omega _{7}t_{i}&\sum \sin \omega _{1}t_{i}\cos \omega _{7}t_{i}&\sum \sin \omega _{2}t_{2}\cos \omega _{7}t_{i}&\cdots &\sum \cos \omega _{1}t_{i}\cos \omega _{7}t_{i}&\cdots \\\\\end{array}}\right]&\left[{\begin{array}{c}\\{\bar {\phi }}\\\\A_{1}\\\\A_{2}\\\\\vdots \\\\A_{7}\\\\B_{1}\\\\B_{2}\\\\\vdots \\\\B_{7}\\\\\end{array}}\right]&=&\left[{\begin{array}{l}\\\sum \phi _{i}\\\\\sum \phi _{i}\sin \omega _{1}ti\\\\\sum \phi _{i}\sin \omega _{2}ti\\\\\vdots \\\\\sum \phi _{i}\sin \omega _{7}ti\\\\\sum \phi _{i}\cos \omega _{1}ti\\\\\sum \phi _{i}\cos \omega _{2}ti\\\\\vdots \\\\\sum \phi _{i}\cos \omega _{7}ti\\\\\end{array}}\right]\\A&x&&b\end{array}}}](https://www.myroms.org/www.myroms.org/v1/media/math/render/svg/bdfb7828998b874d9d040b7b058c557563183d89)