Re: Sinusoidal Nonlinear Fit
- To: mathgroup at smc.vnet.net
- Subject: [mg7887] Re: Sinusoidal Nonlinear Fit
- From: Mark Evans <evans at gte.net>
- Date: Thu, 17 Jul 1997 15:35:48 -0400
- Organization: None
- Sender: owner-wri-mathgroup at wolfram.com
Mark Evans wrote:
>
> I am foiled by NonlinearFit....
I found the magic command for getting a good fit based on trigonometric
functions:
<<NumericalMath`TrigFit`
fit = Chop[TrigFit[Flatten[Take[Transpose[passive4],{2}]], 5, {t, 3.45,
13.45}]]
The book says that this TrigFit uses Fourier components directly, which
is essentially what I wanted. I can use the trig function with the
largest coefficient as the best-fit sinusoid.
I am still puzzled why NonlinearFit could not do this job. Here again
is the data if you missed it in the first message.
Is this considered a "bug" in NonlinearFit? Or is NonlinearFit not
supposed to handle periodic functions?
-- Mark
passive4 =
{{3.45, 634.765625},
{3.5, 622.5585937},
{3.55, 639.6484375},
{3.5999999, 603.0273437},
{3.6500001, 649.4140625},
{3.7, 654.296875},
{3.75, 690.9179687},
{3.8, 678.7109375},
{3.8499999, 712.890625},
{3.9000001, 751.953125},
{3.95, 839.84375},
{4., 849.609375},
{4.0500002, 949.7070312},
{4.0999999, 917.96875},
{4.1500001, 1022.949219},
{4.1999998, 974.1210937},
{4.25, 1076.660156},
{4.3000002, 1003.417969},
{4.3499999, 1096.191406},
{4.4000001, 1064.453125},
{4.4499998, 1105.957031},
{4.5, 1088.867188},
{4.5500002, 1101.074219},
{4.5999999, 1105.957031},
{4.6500001, 1098.632813},
{4.6999998, 1120.605469},
{4.75, 1091.308594},
{4.8000002, 1127.929688},
{4.8499999, 1096.191406},
{4.9000001, 1123.046875},
{4.9499998, 1081.542969},
{5., 1118.164063},
{5.0500002, 1081.542969},
{5.0999999, 1127.929688},
{5.1500001, 1086.425781},
{5.1999998, 1130.371094},
{5.25, 1076.660156},
{5.3000002, 1132.8125},
{5.3499999, 1083.984375},
{5.4000001, 1147.460938},
{5.4499998, 1066.894531},
{5.5, 1118.164063},
{5.5500002, 998.5351562},
{5.5999999, 1047.363281},
{5.6500001, 949.7070312},
{5.6999998, 1000.976563},
{5.75, 910.6445312},
{5.8000002, 947.265625},
{5.8499999, 883.7890625},
{5.9000001, 908.203125},
{5.9499998, 852.0507812},
{6., 866.6992187},
{6.0500002, 793.4570312},
{6.0999999, 781.25},
{6.1500001, 717.7734375},
{6.1999998, 690.9179687},
{6.25, 651.8554687},
{6.3000002, 620.1171875},
{6.3499999, 563.9648437},
{6.4000001, 537.109375},
{6.4499998, 502.9296875},
{6.5, 461.4257812},
{6.5500002, 446.7773437},
{6.5999999, 397.9492187},
{6.6500001, 397.9492187},
{6.6999998, 351.5625},
{6.75, 334.4726562},
{6.8000002, 305.1757812},
{6.8499999, 283.203125},
{6.9000001, 285.6445312},
{6.9499998, 278.3203125},
{7., 261.2304687},
{7.0500002, 246.5820312},
{7.0999999, 178.2226562},
{7.1500001, 200.1953125},
{7.1999998, 190.4296875},
{7.25, 153.8085937},
{7.3000002, 180.6640625},
{7.3499999, 197.7539062},
{7.4000001, 183.1054687},
{7.4499998, 166.015625},
{7.5, 197.7539062},
{7.5500002, 153.8085937},
{7.5999999, 168.4570312},
{7.6500001, 200.1953125},
{7.6999998, 200.1953125},
{7.75, 190.4296875},
{7.8000002, 190.4296875},
{7.8499999, 251.4648437},
{7.9000001, 207.5195312},
{7.9499998, 270.9960937},
{8., 241.6992187},
{8.0500002, 275.8789062},
{8.1000004, 341.796875},
{8.1499996, 400.390625},
{8.1999998, 434.5703125},
{8.25, 478.515625},
{8.3000002, 515.1367187},
{8.3500004, 527.34375},
{8.3999996, 573.7304687},
{8.4499998, 603.0273437},
{8.5, 649.4140625},
{8.5500002, 649.4140625},
{8.6000004, 708.0078125},
{8.6499996, 705.5664062},
{8.6999998, 771.484375},
{8.75, 756.8359375},
{8.8000002, 827.6367187},
{8.8500004, 803.2226562},
{8.8999996, 883.7890625},
{8.9499998, 852.0507812},
{9., 944.8242187},
{9.0500002, 903.3203125},
{9.1000004, 988.7695312},
{9.1499996, 952.1484375},
{9.1999998, 1022.949219},
{9.25, 1000.976563},
{9.3000002, 1059.570313},
{9.3500004, 1037.597656},
{9.3999996, 1049.804688},
{9.4499998, 1071.777344},
{9.5, 1032.714844},
{9.5500002, 1059.570313},
{9.6000004, 1052.246094},
{9.6499996, 1066.894531},
{9.6999998, 1013.183594},
{9.75, 1074.21875},
{9.8000002, 1015.625},
{9.8500004, 1054.6875},
{9.8999996, 996.09375},
{9.9499998, 1059.570313},
{10., 996.09375},
{10.0500002, 1054.6875},
{10.1000004, 966.796875},
{10.1499996, 1010.742188},
{10.1999998, 908.203125},
{10.25, 937.5},
{10.3000002, 849.609375},
{10.3500004, 900.8789062},
{10.3999996, 817.8710937},
{10.4499998, 864.2578125},
{10.5, 783.6914062},
{10.5500002, 803.2226562},
{10.6000004, 732.421875},
{10.6499996, 751.953125},
{10.6999998, 690.9179687},
{10.75, 683.59375},
{10.8000002, 627.4414062},
{10.8500004, 622.5585937},
{10.8999996, 568.8476562},
{10.9499998, 551.7578125},
{11., 529.7851562},
{11.0500002, 500.4882812},
{11.1000004, 468.75},
{11.1499996, 446.7773437},
{11.1999998, 424.8046875},
{11.25, 383.3007812},
{11.3000002, 390.625},
{11.3500004, 341.796875},
{11.3999996, 334.4726562},
{11.4499998, 314.9414062},
{11.5, 302.734375},
{11.5500002, 273.4375},
{11.6000004, 256.3476562},
{11.6499996, 246.5820312},
{11.6999998, 251.4648437},
{11.75, 224.609375},
{11.8000002, 224.609375},
{11.8500004, 195.3125},
{11.8999996, 163.5742187},
{11.9499998, 141.6015625},
{12., 151.3671875},
{12.0500002, 178.2226562},
{12.1000004, 190.4296875},
{12.1499996, 173.3398437},
{12.1999998, 175.78125},
{12.25, 139.1601562},
{12.3000002, 195.3125},
{12.3500004, 156.25},
{12.3999996, 217.2851562},
{12.4499998, 222.1679687},
{12.5, 256.3476562},
{12.5500002, 244.140625},
{12.6000004, 258.7890625},
{12.6499996, 273.4375},
{12.6999998, 346.6796875},
{12.75, 375.9765625},
{12.8000002, 400.390625},
{12.8500004, 429.6875},
{12.8999996, 441.8945312},
{12.9499998, 490.7226562},
{13., 490.7226562},
{13.0500002, 517.578125},
{13.1000004, 505.3710937},
{13.1499996, 541.9921875},
{13.1999998, 527.34375},
{13.25, 546.875},
{13.3000002, 527.34375},
{13.3500004, 556.640625},
{13.3999996, 515.1367187},
{13.4499998, 559.0820312}};