Student Support Forum: 'Find fit for sinusoidal data' topicStudent Support Forum > General > "Find fit for sinusoidal data"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Virginia 11/26/12 12:29pm Hi, I am trying to use FindFit to approximate a seasonal data to a model as: model = b + a Sin[ w t + p] However, Mathematica is giving me a terrible fit while even Excel Solver gives me a better result. I was wondering what am I doing wrong? See the data bellow: SSdata={{150., -0.273281}, {150.1, -0.162835}, {150.2, -0.0464494}, {150.3, 0.0748678}, {150.4, 0.200111}, {150.5, 0.328285}, {150.6, 0.458405}, {150.7, 0.589504}, {150.8, 0.720635}, {150.9, 0.850873}, {151., 0.979317}, {151.1, 1.1051}, {151.2, 1.22737}, {151.3, 1.34535}, {151.4, 1.45826}, {151.5, 1.5654}, {151.6, 1.66612}, {151.7, 1.75981}, {151.8, 1.84596}, {151.9, 1.92412}, {152., 1.99395}, {152.1, 2.05518}, {152.2, 2.10767}, {152.3, 2.15139}, {152.4, 2.18644}, {152.5, 2.21304}, {152.6, 2.23154}, {152.7, 2.24241}, {152.8, 2.24624}, {152.9, 2.24371}, {153., 2.18484}, {153.1, 2.09792}, {153.2, 2.02372}, {153.3, 1.9609}, {153.4, 1.90824}, {153.5, 1.86463}, {153.6, 1.82904}, {153.7, 1.80051}, {153.8, 1.77819}, {153.9, 1.76125}, {154., 1.74897}, {154.1, 1.74067}, {154.2, 1.73571}, {154.3, 1.73353}, {154.4, 1.73358}, {154.5, 1.73539}, {154.6, 1.73849}, {154.7, 1.74249}, {154.8, 1.747}, {154.9, 1.75167}, {155., 1.7562}, {155.1, 1.76029}, {155.2, 1.76369}, {155.3, 1.76616}, {155.4, 1.7675}, {155.5, 1.76751}, {155.6, 1.76605}, {155.7, 1.76296}, {155.8, 1.75813}, {155.9, 1.75145}, {156., 1.74284}, {156.1, 1.73223}, {156.2, 1.69207}, {156.3, 1.6016}, {156.4, 1.51142}, {156.5, 1.42083}, {156.6, 1.32922}, {156.7, 1.23606}, {156.8, 1.1409}, {156.9, 1.04335}, {157., 0.943118}, {157.1, 0.840025}, {157.2, 0.733996}, {157.3, 0.625094}, {157.4, 0.513533}, {157.5, 0.399703}, {157.6, 0.284185}, {157.7, 0.16776}, {157.8, 0.0514133}, {157.9, -0.0636781}, {158., -0.17617}, {158.1, \ -0.284592}, {158.2, -0.387395}, {158.3, -0.483019}, {158.4, \ -0.569952}, {158.5, -0.646795}, {158.6, -0.712314}, {158.7, \ -0.765485}, {158.8, -0.805519}, {158.9, -0.831878}, {159., \ -0.844268}, {159.1, -0.842635}, {159.2, -0.827135}, {159.3, \ -0.798119}, {159.4, -0.756097}, {159.5, -0.701714}, {159.6, \ -0.635723}, {159.7, -0.558962}, {159.8, -0.472332}, {159.9, \ -0.376779}, {160., -0.273281}, {160.1, -0.162835}, {160.2, \ -0.0464494}, {160.3, 0.0748679}, {160.4, 0.200111}, {160.5, 0.328285}, {160.6, 0.458405}, {160.7, 0.589504}, {160.8, 0.720635}, {160.9, 0.850873}, {161., 0.979317}, {161.1, 1.1051}, {161.2, 1.22737}, {161.3, 1.34535}, {161.4, 1.45826}, {161.5, 1.5654}, {161.6, 1.66612}, {161.7, 1.75981}, {161.8, 1.84596}, {161.9, 1.92412}, {162., 1.99395}, {162.1, 2.05518}, {162.2, 2.10767}, {162.3, 2.15139}, {162.4, 2.18644}, {162.5, 2.21304}, {162.6, 2.23154}, {162.7, 2.24241}, {162.8, 2.24624}, {162.9, 2.24371}, {163., 2.18484}, {163.1, 2.09792}, {163.2, 2.02372}, {163.3, 1.9609}, {163.4, 1.90824}, {163.5, 1.86463}, {163.6, 1.82904}, {163.7, 1.80051}, {163.8, 1.77819}, {163.9, 1.76125}, {164., 1.74897}, {164.1, 1.74067}, {164.2, 1.73571}, {164.3, 1.73353}, {164.4, 1.73358}, {164.5, 1.73539}, {164.6, 1.73849}, {164.7, 1.74249}, {164.8, 1.747}, {164.9, 1.75167}, {165., 1.7562}, {165.1, 1.76029}, {165.2, 1.76369}, {165.3, 1.76616}, {165.4, 1.7675}, {165.5, 1.76751}, {165.6, 1.76605}, {165.7, 1.76296}, {165.8, 1.75813}, {165.9, 1.75145}, {166., 1.74284}, {166.1, 1.73223}, {166.2, 1.69207}, {166.3, 1.6016}, {166.4, 1.51142}, {166.5, 1.42083}, {166.6, 1.32922}, {166.7, 1.23606}, {166.8, 1.1409}, {166.9, 1.04335}, {167., 0.943117}, {167.1, 0.840025}, {167.2, 0.733996}, {167.3, 0.625094}, {167.4, 0.513532}, {167.5, 0.399703}, {167.6, 0.284184}, {167.7, 0.16776}, {167.8, 0.0514132}, {167.9, -0.0636782}, {168., -0.17617}, {168.1, \ -0.284592}, {168.2, -0.387395}, {168.3, -0.483019}, {168.4, \ -0.569953}, {168.5, -0.646795}, {168.6, -0.712314}, {168.7, \ -0.765485}, {168.8, -0.80552}, {168.9, -0.831878}, {169., -0.844269}, \ {169.1, -0.842635}, {169.2, -0.827135}, {169.3, -0.798119}, {169.4, \ -0.756097}, {169.5, -0.701714}, {169.6, -0.635724}, {169.7, \ -0.558962}, {169.8, -0.472332}, {169.9, -0.376779}, {170., \ -0.273281}, {170.1, -0.162835}, {170.2, -0.0464494}, {170.3, 0.0748679}, {170.4, 0.200111}, {170.5, 0.328285}, {170.6, 0.458405}, {170.7, 0.589504}, {170.8, 0.720635}, {170.9, 0.850873}, {171., 0.979317}, {171.1, 1.1051}, {171.2, 1.22737}, {171.3, 1.34535}, {171.4, 1.45826}, {171.5, 1.5654}, {171.6, 1.66612}, {171.7, 1.75981}, {171.8, 1.84596}, {171.9, 1.92412}, {172., 1.99395}, {172.1, 2.05518}, {172.2, 2.10767}, {172.3, 2.15139}, {172.4, 2.18644}, {172.5, 2.21304}, {172.6, 2.23154}, {172.7, 2.24241}, {172.8, 2.24624}, {172.9, 2.24371}, {173., 2.18484}, {173.1, 2.09792}, {173.2, 2.02372}, {173.3, 1.9609}, {173.4, 1.90824}, {173.5, 1.86463}, {173.6, 1.82904}, {173.7, 1.80051}, {173.8, 1.77819}, {173.9, 1.76125}, {174., 1.74897}, {174.1, 1.74067}, {174.2, 1.73571}, {174.3, 1.73353}, {174.4, 1.73358}, {174.5, 1.73539}, {174.6, 1.73849}, {174.7, 1.74249}, {174.8, 1.747}, {174.9, 1.75167}, {175., 1.7562}, {175.1, 1.76029}, {175.2, 1.76369}, {175.3, 1.76616}, {175.4, 1.7675}, {175.5, 1.76751}, {175.6, 1.76605}, {175.7, 1.76296}, {175.8, 1.75813}, {175.9, 1.75145}, {176., 1.74284}, {176.1, 1.73223}, {176.2, 1.69207}, {176.3, 1.6016}, {176.4, 1.51142}, {176.5, 1.42083}, {176.6, 1.32922}, {176.7, 1.23606}, {176.8, 1.1409}, {176.9, 1.04335}, {177., 0.943117}, {177.1, 0.840025}, {177.2, 0.733996}, {177.3, 0.625094}, {177.4, 0.513532}, {177.5, 0.399703}, {177.6, 0.284185}, {177.7, 0.16776}, {177.8, 0.0514133}, {177.9, -0.0636781}, {178., -0.17617}, {178.1, \ -0.284592}, {178.2, -0.387395}, {178.3, -0.483019}, {178.4, \ -0.569952}, {178.5, -0.646795}, {178.6, -0.712314}, {178.7, \ -0.765485}, {178.8, -0.805519}, {178.9, -0.831878}, {179., \ -0.844268}, {179.1, -0.842635}, {179.2, -0.827135}, {179.3, \ -0.798119}, {179.4, -0.756097}, {179.5, -0.701714}, {179.6, \ -0.635723}, {179.7, -0.558962}, {179.8, -0.472332}, {179.9, \ -0.376779}, {180., -0.273281}} model = b + a Sin[ w t + p] fit = FindFit[SSdata, {model}, {a, b, w, p}, t] The answer Mathematica gives me is {a -> -0.225031, b -> 1.01087, w -> 0.920843, p -> 13.2377} While Excel {a -> 1.337, b -> 0.98, w -> 0.61, p -> -11.94} URL: ,

 Subject (listing for 'Find fit for sinusoidal data') Author Date Posted Find fit for sinusoidal data Virginia 11/26/12 12:29pm Re: Find fit for sinusoidal data jf 11/27/12 1:02pm Re: Find fit for sinusoidal data Bill Simpson 11/28/12 00:33am
 Next Comment > Help | Reply To Topic