Jump to content

Adjusting (fit) two together function


Recommended Posts

hello everyone :)

 

So, I have two functions that contain several parameters (including 1 single parameters is common between the two functions) I adjusted the two functions separately and I get a good curves, by cons I don't find the same value of the common parameter. So, I need  can be adjusted both functions together.

 

You will find enclosed rooms more details.

 

Thank you in advance for your help.

Link to comment

As is often the case, removing a degree of freedom seems to degrade the quality of the fit (The best joint fit is not a great fit to either of the individual curves.).  By forcing the sigmas to match, the fit finds the point where the rising edge is well matched by one function and the falling edge by the other.

 

Right now it looks to me like the model is not a great fit to the data with the sigma value constrained.  You could either try to refine the model (effectively return that DOF) or try to find the best constrained fit.

 

Here is what I see, I'll post the VIs here after I double check for pilot error.

 


post-26690-0-22242800-1396035841_thumb.p

Link to comment

I can also get a very nice fit for both curves like you show when I allow sigma to be different (I think one is near 70 and one is closer to 80).  I have forced a single sigma between the two curves (what you are tying to do) that is why the fit I show is not as good.  Basically the two curves have different widths and sigma is the parameter most strongly correlated to that width. 

Link to comment

Found out why I thought your data looked out of whack, there were more y points than x points so they were not aligning quite right for me.  Now I think your data looks fine and is well described by a single sigma parameter.

 


post-26690-0-98304600-1396046708_thumb.p

 

Same sigma for both.  I will attach the VIs I used.  I use a single fit but the fit function VI returns F1(t) followed by F2(t). 

JointFitExample.vi

TestJointFit.vi

Link to comment

I fit both functions with a single piecewise function.  That piecewise function is F1(t) for all t followed by F2(t) for all t.  The effect is that F1(t) is used for the first N points of the y data and F2(t) is used for the next N points.  Each curve gets its own function, and they can share parameters as needed.

Link to comment

For each additional function (assuming they all share the same x values) you make three changes:  first add the data to the y data array fed into the Nonlinear Fit VI, second modify the F(x) vi to calculate the new function and add the results to the end of the F(x,a) array and third add any parameters to a that are new to that function (if any).  That's it.

Link to comment
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.