File Exchange
Try Origin for Free
The Origin Forum
Home
|
Profile
|
Register
|
Active Topics
|
Members
|
Search
|
FAQ
|
Send File to Tech support
All Forums
Origin Forum for Programming
Forum for Origin C
Fitting with NLFitSession
Note:
Only the poster of this message, and the Moderator can edit the message.
Screensize:
640 x 480
800 x 600
1024 x 768
1280 x 1024
UserName:
Password:
Anti-Spam Code:
Format Mode:
Basic
Help
Prompt
Format:
Font
Andale Mono
Arial
Arial Black
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Lucida Console
Script MT Bold
Stencil
Tahoma
Times New Roman
Trebuchet MS
Verdana
Size
1
2
3
4
5
6
Color
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
LimeGreen
Forum:
Forum for Origin C
Subject:
Message:
* HTML is OFF
*
Forum Code
is ON
Smilies
Origin Ver. and Service Release (Select Help-->About Origin): 2020b Operating System:win10 64bit Hi, I have some troubles fixing parameters with PWL3 fit function. Here's my code: [code]bool ASP_VO2_fit_PWL3(vector vX, vector vY, vector& vParam, double dXval, int fix) { NLFitSession nlfS; nlfS.SetFunction("PWL3"); nlfS.SetData(vY, vX); // Initialisation vector vParamValues(6); vector<int> vnParamsOffsets(6); // the begin index of one group of parameters, normally one group for one dataset nlfS.ParamsInitValues(); nlfS.GetParamValuesAndOffsets(vParamValues, vnParamsOffsets); if (fix > 0) // if fix xi1 or xi2 { if (fix == 1) // fix xi1 { vParamValues[2] = dXval; nlfS.SetParamFix(2, true); } if (fix == 2) // fix xi2 { vParamValues[4] = dXval; nlfS.SetParamFix(4, true); } nlfS.SetParamValues(vParamValues); } // Fit vector vErr(6); if (nlfS.Fit()) { nlfS.GetFitResultsParams(vParam, vErr); return true; } return false; }[/code] if fix = 0, fitting should be free if fix = 1, I want to fix xi1 (3rd parameter) as dXval if fix = 2, I want to fix xi2 (4th parameter) as dXval When fix > 0, I get different result than fix = 0, but xi1 or xi2 are not fixed to dXval What am I doing wrong ? Bonus question: I tried NLFit Class and got results 10 times faster. But I couldn't find how to fix parameters. Is it possible ?
Check here to subscribe to this topic.
The Origin Forum
© 2020 Originlab Corporation
Snitz Forums 2000