Problems with y = a sin (bx + c) + offset

32 views
Skip to first unread message

Alec Myers

unread,
Mar 8, 2012, 10:05:31 AM3/8/12
to Zunzun.com discussion group
Hi James,

Glad to see the site back up again after yesterday's problems.

I can't get sensible data from this one curve fit option.

Here's my data:

angle y
81.09 -238
81.53 -200
81.98 -164
82.44 -77
82.9 3
83.41 51
83.86 60
84.29 52
84.72 -3
85.15 -92
85.6 -140
86.05 -217
86.47 -235
86.89 -193
87.35 -163
87.77 -89
88.2 -14
88.62 38
89.02 57
89.42 67
89.82 33
90.22 -2
90.63 -89
91.03 -177
91.47 -232
91.85 -236
92.23 -219
92.6 -177
92.98 -105
93.35 -67
93.72 8
94.09 60
94.46 71
94.87 63
95.23 24
95.59 -34
95.94 -107
96.3 -145
96.67 -209
97.02 -238
97.36 -232
97.7 -199
98.04 -155
98.42 -94
98.75 -64
99.08 -3
99.41 52
99.73 78
100.05 75
100.38 48
100.7 -2
101.02 -33
101.34 -100
101.7 -168
102.02 -221
102.33 -236
102.64 -233
102.95 -210
103.25 -171
103.54 -145
103.84 -89
104.13 -27
104.44 27
104.72 47
105 72
105.29 72
105.57 50
105.85 33
106.12 -14
106.39 -74
106.67 -138
106.94 -167
107.25 -211
107.5 -232
107.77 -232
108.03 -226
108.3 -204
108.56 -166
108.82 -144
109.07 -96
109.31 -47
109.57 1
109.81 39
110.04 55
110.27 70
110.5 64
110.73 63
110.97 41
111.19 10
111.41 -31
111.64 -56
111.89 -111
112.11 -163
112.33 -204
112.55 -217
112.76 -234
112.97 -236
113.18 -233
113.39 -218
113.6 -194
113.83 -158
114.03 -121
114.23 -102
114.43 -63


Should be a nice sine wave with period very close to 1.0., as you can
see from a graph. Instead I get a frequency of 10125, wrong by 4
orders of magnitude. The other parameters look about right:

y = a * sin(bx + c) + Offset

Fitting target of lowest sum of squared absolute error =
1.1220029423531962E+06

a = -4.8071579773720501E+01
b = 1.0125399059882269E+04
c = 4.6995054360946488E+03
Offset = -8.5285118017818263E+01


Am I doing something wrong or is there a glitch in the code?

zunzun.com

unread,
Mar 8, 2012, 2:14:03 PM3/8/12
to zunzun_...@googlegroups.com
Try using bounds.
 
     James
Reply all
Reply to author
Forward
0 new messages