Hi, So I think you try to find the parameters A and phi of the sinefunction y=f(t)=A*sin(2pi*f*x+phi). In the manual you should look at examples with lsfitcreatef function or lsfitcreatefg function. There it is explained very good. So you have to choose: x=x[0], A=c[0], phi=c[1]. Dim x(,) As Double = New Double(,){{-1},{-0.8},{-0.6},{-0.4},{-0.2},{0},{0.2},{0.4},{0.6},{0.8},{1.0}} here you have to insert your x-data. Dim y() As Double = New Double(){0.223130,0.382893,0.582748,0.786628,0.941765,1.000000,0.941765,0.786628,0.582748,0.382893,0.223130} and here the y-data
Dim c() As Double = New Double(){1,1} here you have to insert the startvalue {A,phi}.Here you have to choose values that are near to the expected A, phi. So if A is 50, an phi is 120 try with New Double(){40,100}.
I recommend you to take a sinefunction with some parameters (for example A=2 and phi= 100°) and calculate 10 values (x,y). With these values you let the programm calculate your parameters A,phi and so you can compare them to what you expect. ok?
|