Fitting multiple datasets to different functions using shared parametersTo solve your problem you can make a function definition containing all
three functions where you introduce a extra parameter to select the
function to use.
An example:
Define your function as an Y-script (You select the type in the bottom of the
function definition window) as shown below.
if(r==0) { /* 1. function : */
y=A/(1+B^2*x^2)
} else { /* 2. function : */
y=A*B*x/(1+B^2*x^2)
}
For three and more functions, extend the second branch and include a
test if r==1 etc
Make sure that you doesn't make any mistakes, Origin doesn't give any warning
if something is wrong (example: replacing (r==0) with (r=0) doesn't give any
error except that the fitting is not working correctly).
Under Action->Dataset make sure that you are in the "Advanced"-mode
(Press More if it is visible) and put a cross in "Fit Multiple Datsets",
Under "Parameter Sharing" double-click on all parameters (so they are marked
with "Shared") except the r parameter used to select the actual function.
Press the "Add Data" to add a extra dataset Y(2) in the
"Variables" list box (for three function add one more).
Assign datasets to Y(1), Y(2) etc. Activate the fit menu and
fix parameters r=0 and r_2 = 1 (and for three functions r_3=2).
Add some starting values for the other parameters and you can
start the curve fitting.
Be careful when you assign the datasets so you get correct
dataset to correct Y(n), otherwise the fitting result will be
just rubbish. (You can interchange the values of r, r_2, r_3
if you have assigned the datasets in a different order).
If you are using only two functions you could define it as a
expression and use the following form instead
y=(A*r+ A*B*x *(r-1))/(1+B^2*x^2)
where r=0 selects the first function and r=1 the second.
According to the manual it is an easier way to do the fitting
(page 327 (Origin 4.0 User's manual) y_1=, y_2= ), but it looks
like this method is not working. (The y_2 function is not
evaluated correctly, the problem is reported).
If you send a response showing who you are you can get a copy
of my example as an Origin project file.