Customers has the requirement to fit a 3D scattered plot with a nonlinear curve and draw the fitted curve on top of the scattered plot. This can be achieved by creating user’s own multivariate fitting functions y=f(x) and z=g(x). In this example, assume user has the dataset plotted as 3D points in the following graph and wants to fit the points with two functions: y = a + b*x and z = c0 + c1*x + c2*x^2 + c3*x^3, we will show how to perform the fitting and make the fitted curve plot. Please download the attached zip file and open the opj in Origin to follow the steps below.
1. Select menu Tools:Fitting Function Organizer… to open the dialog. In the left select the User Defined folder. Click New Function button on the right to start define a new fitting function. In Function Name text window, enter a name LinePoly3. Set Independent Variables as x, Dependent Variables as y, z，Parameter Names as a,b,c0,c1,c2,c3. In the Function edit box, enter:
y = a*x + b;
z = c0 + c1*x + c2*x^2 +c3*x^3;
2. Scroll down to Parameter Settings section, click on the button besides the editing box to open up the Parameter Settings dialog. Set all the initial values to 1. Click OK to close the dialog, then click Save to save the function.
3. Open the opj file Highlight the entire worksheet, select from menu Analysis: Fitting: Nonlinear Curve Fit… to open the dialog. With Settings tab activated, select Function Selection in the left panel. In the Category dropdown list, select User Defined. In Function dropdown list, select function LinePoly3 just created. The fitted curves with initially-guessed parameters are also displayed in the bottom panel. Click Fit to perform the fitting.
4. Go to the result sheet FitNLCurve1, Highlight column C, right click and select from context menu Set as: Z. Move the mouse to the left/right edge of the highlighted column until the cursor changes to graph shape, press down mouse and drag to the original 3D plot.