The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Integer fitting parameter
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

karvek

13 Posts

Posted - 07/06/2016 :  08:58:09 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

karvek

13 Posts

Posted - 07/11/2016 :  07:44:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 07/11/2016 :  10:57:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

karvek

13 Posts

Posted - 07/12/2016 :  08:22:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 07/12/2016 :  4:33:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Chris D

428 Posts

Posted - 07/13/2016 :  08:59:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 07/14/2016 :  3:31:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000