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 for Programming
 Forum for Origin C
 How to add input box into my fitting function?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jsilverstein

USA
1 Posts

Posted - 10/10/2012 :  11:51:11 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.6 (64 bit)
Operating System: Windows 7


Hi all

I have a fitting function that requires user inputted data and currently I am changing the code each time, but I'd rather have a dialog box that prompts for the entry of these numbers each time the program runs. The trick is not having it inside the loop, where it'll repeat many times.

I'm looking for input boxes for w1, w2, and B

My code:

//----------------------------------------------------------
//
void _nlsfDiffusionRelaxation(
// Fit Parameter(s):
double D, double Fa, double Fb,
// Independent Variable(s):
double t,
// Dependent Variable(s):
double& An)
{
// Beginning of editable part
double w1;
double w2;
double B;
double A;

w1=1.549*10^-6;
w2=0.099;
B=7.934*10^-5;

double Sum;
Sum=0;
for(int n = 0; n < 50; n++)
{
A=(w1*t+w2*(1-exp(-B*t)));
Sum +=(((-1)^n)/(2*n+1)*exp(-(D*t*(((2*n+1)*PI)/(2*0.011)^2))));
An=Fa*(1-(4/PI)*Sum)+Fb*A;
}
// End of editable part
}


Thanks in advance

Penn

China
644 Posts

Posted - 10/10/2012 :  11:49:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

For allowing user to input w1, w2 and B, the simple solution is to set these as fitting parameters, and then fix them with the desired values, that is to say, user can specify their values accordingly. Please see the following image on how to fix the values.



Penn
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