Named Range for Fitting Parameters

Named range is introduced in Origin 2022 that user can assign names to worksheet cells for later use. We further improved this area in Origin 2022b to allow using named range in certain analysis tools such as linear fit and nonlinear curve fit.

Please first download the zip file which contains two project files. You can watch the demo above and perform the operations in the NamedRangeInRegression.opju. There is custom report on Notes sheet in each book using new improvements of Notes window in Origin 2022b.

You can also start from the data.opju and follow the steps below to create the named range from scratch:

  1.  Open data.opju in Origin 2022b. The original data is already plotted out in Graph1 and we will then use the defined name to specify the data range to be fitted. Col(C) and Col(D) have the Name and Value we will use to define the named ranges.
  2.  Click on the cell D1, in the popped-up mini tool bar, select Define Name… In the dialog, make sure the Name entry is auto filled with the text from the left cell to D1. Make sure the Scope of the named range is set to Project. Click OK. Repeat it for the cells D2, D4 and D5 to define four named ranges.
  3. To view all the defined names, you can select from menu Data:Name Manager… The table lists the detailed information of each name.
  4. Now we can use the defined names to set parameters linear fit dialog. Activate Graph1 and select menu Analysis: Fitting:Linear Fit… . In the dialog, expand the Input Data node and set Rows dropdown to By X and enter leftx1 in the From entry and rightx1 in the To entry. Notice that on the graph the x range gets updated. Click OK to run the fitting.
  5. With the graph activated, open Linear Fit dialog again and set the x range to leftx2 and rightx2 this time. Click OK to run the fitting.
  6. Two  fitted   lines are  added to the  graph.  We  can  now  adjust  the  fit range  by  changing the  cell values  in  the worksheet.
  7. Change the rightx1 and leftx2 value to 5. Click the yellow lock on the graph to recalculate.  The  data  range  gets  updated.
  8. Likewise, in the second example, we will set the fitting parameter values and bounds using named range. Open NLFit folder in data.opju, define the name ranges using the mini toolbar.
  9. With the graph activated, select from menu  Analysis:Fitting:Nonlinear Curve Fit. Set the fitting function  to GaussAmp.
  10. Go to Parameters tab, set y0 to name offset.
  11. Go to Bounds tab, set the lower/upper bounds with the named range shown below:
  12. Click Fit button to generate the result. Note the fitted parameters hit the boundaries set by the defined name. 
  13. Now adjust the values in the worksheet and see how the fitting result gets updated.

Leave a Reply

Your email address will not be published. Required fields are marked *