mimi25 Posted March 28, 2014 Report Share Posted March 28, 2014 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. Quote Link to comment
Darin Posted March 28, 2014 Report Share Posted March 28, 2014 Post a VI with the data saved as default values inside controls and I can show you how to ditch the Express VIs and get the job done. Quote Link to comment
Darin Posted March 28, 2014 Report Share Posted March 28, 2014 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. Quote Link to comment
mimi25 Posted March 28, 2014 Author Report Share Posted March 28, 2014 thank you for your reply, Quote Link to comment
Darin Posted March 28, 2014 Report Share Posted March 28, 2014 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. Quote Link to comment
mimi25 Posted March 28, 2014 Author Report Share Posted March 28, 2014 exactly, Quote Link to comment
Darin Posted March 28, 2014 Report Share Posted March 28, 2014 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. 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 Quote Link to comment
Darin Posted March 30, 2014 Report Share Posted March 30, 2014 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. Quote Link to comment
mimi25 Posted March 31, 2014 Author Report Share Posted March 31, 2014 (edited) ok, thank you very much. Edited April 8, 2014 by mimi25 Quote Link to comment
Darin Posted March 31, 2014 Report Share Posted March 31, 2014 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. Quote Link to comment
mimi25 Posted March 31, 2014 Author Report Share Posted March 31, 2014 thank you for your reply, Quote Link to comment
Darin Posted March 31, 2014 Report Share Posted March 31, 2014 Add a second Split 1D array to the second (lower) output array and give it the same length as the first Split function. Quote Link to comment
mimi25 Posted March 31, 2014 Author Report Share Posted March 31, 2014 Sorry, but I don't understand what do you mean Quote Link to comment
mimi25 Posted March 31, 2014 Author Report Share Posted March 31, 2014 This is what I get :/ Quote Link to comment
Darin Posted March 31, 2014 Report Share Posted March 31, 2014 Hard to tell from the picture, but it appears that F2 and G2 are switched in your graphs. You are joining the data F1,F2,G2 and Splitting it up F1,G2,F2. The upper output of Split 1D array is the beginning of the array. Quote Link to comment
Michael Aivaliotis Posted July 9, 2014 Report Share Posted July 9, 2014 This an awesome post where Darin is just talking to himself. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.