Author |
Topic |
|
karvek
13 Posts |
Posted - 07/06/2016 : 08:58:09 AM
|
Origin Ver.9.1SR2 Operating System: Windows 7
Hallo,
I wrote a function in Origin C and I am trying to fit, everything looks fine. However is it possible to force one (or more) fitting parameter to be an integer? I mean, REALLY an integer, not just setting the number of significant digits to 1.
Thanks! G. |
Edited by - karvek on 07/06/2016 08:59:27 AM |
|
Chris D
428 Posts |
Posted - 07/06/2016 : 1:59:39 PM
|
Hi,
Origin C fitting parameters are always double data type. You can't specify them as actual integer type.
Thanks, Chris Drozdowski Originlab Technical Support
|
|
|
karvek
13 Posts |
Posted - 07/11/2016 : 07:44:11 AM
|
Hi,
is there any alternative way to write the fitting function to have integer parameters? I mean by using expression, equation or LabTalk script. |
Edited by - karvek on 07/11/2016 07:45:09 AM |
|
|
Hideo Fujii
USA
1582 Posts |
Posted - 07/11/2016 : 10:57:27 AM
|
Hi karvek,
Can you replace, say for parameter p1, in your function definition with int(p1)? If this failed to converge, how about taking either int(p1) or int(p1)+1, whichever gives the better Chi^2 after finding p1? (Though I'm not sure this is practically okay, or not.)
--Hideo Fujii OriginLab |
|
|
karvek
13 Posts |
Posted - 07/12/2016 : 08:22:37 AM
|
Hi Hideo,
Unfortunately when I substitute p1 with int(p1) my Origin C fail to compile. It says Error, function or variable int not found. I think you cannot force it, at least not this way.
The idea of taking the better Chi^2 was already developing in my mind but my actual concern is, as you can see, fixing the paramter to be integer.
Nevertheless thanks a lot for support, any additional hint will be really appreciated. |
|
|
Hideo Fujii
USA
1582 Posts |
Posted - 07/12/2016 : 4:33:51 PM
|
Hi karvek,
Sorry, although floor(p1) would make the function compilable, but anyway it may never converge - hill climbing will probably always hit a wall.I wonder if you can find a function similar to a step function, but which is smooth, but I'm not certain.
--Hideo Fujii OriginLab |
|
|
Chris D
428 Posts |
Posted - 07/13/2016 : 08:59:42 AM
|
Hi,
You cannot modify a parameter value within the fitting function body. Well, technically you can within the function body, but the changed value will not propagate back out of the function.
If you look at how the fitting function is defined, parameters are passed in to the function by value and not by reference. Hence whatever change you make to them within the function don't effect the value of the parameters that the fitter chose when it calls the function during iteration.
Thanks, Chris Drozdowski Originlab Technical Support
|
|
|
Hideo Fujii
USA
1582 Posts |
Posted - 07/14/2016 : 3:31:43 PM
|
Hi karvek,
I was thinking a smooth function like below instead of int() (or floor()). This may lead fitting to convergence, then after fitting, you can round down the parameter:
--Hideo Fujii OriginLab |
|
|
|
Topic |
|