Calculate formula needed for complex sine wave that models major and minor tides

SOmarN

New member
Joined
Nov 24, 2021
Messages
3
I am trying to find a summed sine wave for my assignment that fits the data points of tide readings from a specific coastal region (Avalon Beach).

The requirements are as follows:
- both tides must touch their averages
- Major (first): 1.82, 0.245
- Minor (second): 1.6175, 0.2725
- peaks should align with data points on the x-axis
- equation should be [math]asin(bx+c)+dsin(ex+f)+g[/math] where 2b ≈ e and d>a

The data points, average lines and other info is at https://www.desmos.com/calculator/ahlz9vqimg

I remember doing a bit of summed sine waves before, but not at this level, only adding 2 equations to get an answer, and not the other way around. I'm not sure what a summed sine wave "model" is.

Things I previously tried:
- Making 1 uniform sine wave that hits the x-axis of the points and the average of the averages of the y-axis of the points (was told to make complex graph)
- Adding 2 sine waves that were zeroed where the other wave was meant to be shown (increasing height centre of 1 increased the height centre of the total)
- Adding 2 sine waves that were "Noned" (i.e. no value/line) where the other value was meant to be shown (cut-off graphs, was told to sum sine waves instead)

I am stuck with the summing because the graph moves in an unusual way, where moving 'c' or 'f' separate from each other changes the height, and I am unsure of how to change the height centre since it's different for both tides.
 
I don't know how to interpret the data in the online calculator. E.g., [imath]\left(7\frac{13}{15}+12, 1.67\right)[/imath] the same as [imath]\left(19\frac{13}{15},1.67\right)[/imath], or is there some special meaning in that unreduced expression?
Also, not sure what "peaks should align with data points on the x-axis" means: do you need something different from a simple minimum square approximation?
 
1. The [math]7\frac{13}{15}+12[/math] is for convenience purposes, since it's 7:52pm, which is 12 hours after 7:52am, and so on.
2. the peaks of the compound sine wave should have a similar x-coordinate to the data points, since they're the high and low tide points of the major and minor tides.
 
1. The [math]7\frac{13}{15}+12[/math] is for convenience purposes, since it's 7:52pm, which is 12 hours after 7:52am, and so on.
2. the peaks of the compound sine wave should have a similar x-coordinate to the data points, since they're the high and low tide points of the major and minor tides.
Thanks. Several more questions/requests:
  1. Is the second value the height of the tide ?
  2. Is there any significance to the colors?
  3. Could you convert the data from the calculator format to a text which can be copied and pasted? I'd rather not retype all your values by hand.
  4. Do I understand correctly that the times are more important than heights (y-values?)?
  5. What is the criterion for the best match? Minimum sum of squared errors? Minimal max. error?
Thanks again.
 
1. yes. in this case it doesn't matter, since the compound sine wave is mean to hit the average line
2. no
3. that's convenient, i did that as well
Table:
1\frac{11}{30}0.2725
7\frac{52}{60}+121.6175
2\frac{2}{60}+240.2725
8\frac{41}{60}+361.6175
2\frac{43}{60}+480.2725
9\frac{32}{60}+601.6175
3\frac{26}{60}+720.2725
10\frac{26}{60}+841.6175
7\frac{39}{60}1.82
1\frac{47}{60}+120.245
8\frac{21}{60}+241.82
2\frac{38}{60}+360.245
9\frac{5}{60}+481.82
3\frac{29}{60}+600.245
9\frac{51}{60}+721.82
4\frac{24}{60}+840.245
Array (2-dimensional):

data = [
[1+11/30, 0.2725],
[7+13/15+12, 1.6175],
[2+1/30+24, 0.2725],
[8+41/60+36, 1.6175],
[2+43/60+48, 0.2725],
[9+32/60+60, 1.6175],
[3+26/60+72, 0.2725],
[10+26/60+84, 1.6175],

[7.65, 1.82],
[107/60+12, 0.245],
[8.35+24, 1.82],
[79/30+36, 0.245],
[109/12+48, 1.82],
[209/60+60, 0.245],
[9.85+72, 1.82],
[4.4+84, 0.245],
]
#end of array

4.yes
5.i'm not sure what those mean. the teacher i asked said it should match the time 'on the dot' (figuratively).

No, thank you. (not 'no thank you' i.e. 'no thanks', but rather "i'm the one thanking you instead")
 
1. yes. in this case it doesn't matter, since the compound sine wave is mean to hit the average line
2. no
3. that's convenient, i did that as well
Table:
1\frac{11}{30}0.2725
7\frac{52}{60}+121.6175
2\frac{2}{60}+240.2725
8\frac{41}{60}+361.6175
2\frac{43}{60}+480.2725
9\frac{32}{60}+601.6175
3\frac{26}{60}+720.2725
10\frac{26}{60}+841.6175
7\frac{39}{60}1.82
1\frac{47}{60}+120.245
8\frac{21}{60}+241.82
2\frac{38}{60}+360.245
9\frac{5}{60}+481.82
3\frac{29}{60}+600.245
9\frac{51}{60}+721.82
4\frac{24}{60}+840.245
Array (2-dimensional):

data = [
[1+11/30, 0.2725],
[7+13/15+12, 1.6175],
[2+1/30+24, 0.2725],
[8+41/60+36, 1.6175],
[2+43/60+48, 0.2725],
[9+32/60+60, 1.6175],
[3+26/60+72, 0.2725],
[10+26/60+84, 1.6175],

[7.65, 1.82],
[107/60+12, 0.245],
[8.35+24, 1.82],
[79/30+36, 0.245],
[109/12+48, 1.82],
[209/60+60, 0.245],
[9.85+72, 1.82],
[4.4+84, 0.245],
]
#end of array

4.yes
5.i'm not sure what those mean. the teacher i asked said it should match the time 'on the dot' (figuratively).

No, thank you. (not 'no thank you' i.e. 'no thanks', but rather "i'm the one thanking you instead")

I thought about your problem, and I cannot see a simple generic solution. Nor am I an expert in the field of tides' computing. I.e., take my suggestions with a grain of salt.
I am skeptical about the requirement that "peaks should align with data points on the x-axis" : sine waves have zero derivatives at the peaks, so empirical measurements of X locations are bound to be imprecise.
If I had to solve this numerical problem I'd treat it as a minimum square error approximation problem. You have a general function [imath]F(a,b,c,d,e,f,g,x) = a\sin(bx+c)+d \sin(ex+f)+g[/imath], and you want to minimize your error [imath]E(a,b,c,d,e,f,g) = \sum_k \left(F(a,b,c,d,e,f,g,x_k)-y_k\right)^2[/imath]. I would try to use some version of a gradient descent optimizer. To speed things up I would carefully select the initalial values of [imath]a,b,c,d,e,f,g[/imath] which look like an approximation. E.g., compute initial values of [imath]a[/imath] and [imath]b[/imath] from the spacing of the peaks, etc.
There might be more specialized methods in your field which I am not familiar with. But if you decide to use my approach feel free to ask questions. Either way good luck with you project!
 
Top