visualdatatools.com Forum Index visualdatatools.com
Discussion for DataTank and DataGraph
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help~

 
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Request Fit Function
View previous topic :: View next topic  
Author Message
martinbond



Joined: 26 Nov 2011
Posts: 2

PostPosted: Sat Nov 26, 2011 7:24 am    Post subject: Help~ Reply with quote

I just tried to fit my data with sin in the arbitrary function:"a*sin(b*x+c)+d",but failed.…I've tried the default template data and it works well.My data displays well in the datagraph…So i'm wondering what's wrong…

There i got 2 screen print please see and help me…
http://photo.renren.com/photo/ap/Qmr7iUX1l9
Back to top
View user's profile Send private message
David
Site Admin


Joined: 25 Nov 2006
Posts: 1940
Location: Chapel Hill, NC

PostPosted: Sat Nov 26, 2011 11:36 am    Post subject: Reply with quote

The initial guess for b needs to be a lot smaller. What happens is that DG finds a local minima, but there certainly is a better minima. So do the following:

- In the Draw guess menu select "Always". This draws the initial guess as well as the fit.
- Change the initial b value. It should be a lot smaller, so try 0.1, 0.01 etc until the initial guess has approximately the same frequency. You could also change the initial guess of a to be 30.

You can also leave the Draw guess at "If it fails" to only draw the initial guess if the minima can't be found.


The mathematica issue is the following. DG is minimizing the function f(a,b,c,d) = sum (y_i - (a*sin(b*x_i + c) + d) )^2
Since the gradient of f is a non-linear function of a,b,c,d there might be many local minima's. Which you find will depend on the initial guess. One way to visualize it is to think of f(a,b,c,d) to be an undulating surface over a four dimensional domain. Easy to visualize for one or two arguments, and four arguments look very similar. Since there is a sin in there, this surface looks very wavy in both b and c. Waves in two dimensions form a sort of ocean surface and there are a lot of local minima's there. You found one that is close to the initial guess (1,1,1,1).


David
Back to top
View user's profile Send private message Send e-mail
martinbond



Joined: 26 Nov 2011
Posts: 2

PostPosted: Sun Nov 27, 2011 12:25 pm    Post subject: Reply with quote

Thank you David...The problem is perfectly solved...
I love the efficiency of the board~
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Request Fit Function All times are GMT - 3 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group