Question: Problem with nonlinear fit

Hello,

I have recently been toying around with nonlinear fitting for as part of a research job and I've been having problems getting nonlinear fit to:

1) work

2)create a good fit.

Here is my input:

> with(Statistics); with(plots); with(LinearAlgebra);
> list1 := Vector([0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 295], datatype = float);

Vector[column](%id = 4322529536)

> list2 := Vector([1687.55, 1698.94, 1704.63, 1693.25, 1610.72, 1616.41, 1653.4, 1696.09, 1724.55, 1770.08, 1750.16, 1687.55, 1619.26, 1627.79, 1664.79, 1735.93, 1676.17, 1624.95, 1644.87, 1738.78, 1744.47, 1693.25, 1624.95, 1642.02, 1642.02, 1647.71, 1630.64, 1622.1, 1642.02, 1698.94, 1770.08, 1747.32, 1721.7, 1667.63, 1619.26, 1548.11, 1570.88, 1659.1, 1727.4, 1730.24, 1727.4, 1724.55, 1704.63, 1639.18, 1633.48, 1684.71, 1679.02, 1704.63, 1670.48, 1642.02, 1656.25, 1667.63, 1690.4, 1676.17, 1716.01, 1696.09, 1727.4, 1667.63, 1585.11, 1610.72], datatype = float);

Vector[column](%id = 4322529656)
>
> f := NonlinearFit(a*sin(b*x+c)+d, list1, list2, x, output = [leastsquaresfunction, residuals]);
[-5.09031241631275222 sin(0.833619786921039996 x + 24.0011555108476742)

+ 1674.57323634408544, Vector[row](%id = 4420792440)]

So the problem seems to be that the vectors aren't declared right. But just a few hours ago (when I initially wrote this) it worked fine. The vectors were listed with all the elements. Now when I hit enter it spits out a block of text saying

 [1..60 Vector_column]
[Datatype:float_8     ]
[Storage: Rectangular]
[Order Fortran_order  ]

Since it is doing this weird thing when I run nonlinear fit i get the fit but it has the vectors hanging around so I can just store the fit as a function like I have above (f:= part).

Also worth note, when I did have it working the sinusoidal fit was not very good. The amplitude was much to small and the frequency much too large. Is there any way to improve non-linear fits or am I stuck having to do it by hand to get a better fit?

Please Wait...