- Purpose
This app can be used to perform piecewise fit on data plotted in the graph.
Features include:
- Two or three segments of the data
- Use different fitting functions, or same function, for each segment
- Option to fix or vary the X value of the segment intersection points
- Use built-in or user-defined fitting functions
- Output fit parameters and statistics for each segment
- Installation
Download the file Piecewise Fit.opx, and then drag-and-drop onto the Origin workspace. An icon will appear in the Apps Gallery window.
- Operation
- Select graph with a 2D scatter or line plot.
- Click the icon in the Apps Gallery window.
- In the pop up dialog, specify number of segments.
- Change or fix the X value of intersection points as needed.
- Choose a function for each segment, or assign same function to all segments.
- Change the max number of iterations and tolerance as needed.
- Select the desired output parameters and statistics.
- Click the Parameters button to provide initial parameters for user-defined functions.
- Click then 1 Iter. button to execute 1 iteration.
- Click the Fit button to perform interactions until the tolerance is reached, or the maximum number of iterations is reached.
- Dialog Settings
- Number of Segments: Specify 2 or 3 segments to split the plot data.
- X Value at Intersection of Two Segments: Specify the X value at the intersection of two segments. You can optionally fix these values.
- Use Same Function for All Segments: If checked, the same fitting function will be used for all segments. If unchecked, you can assign different fitting functions to each segment.
- Function for # Segments: Specify the function for the corresponding segment.
- Use Exiting Function: If checked, you can select a built-in fitting function or a previously created user-defined function. If unchecked, you can type in a new equation.
- Category: Fitting function's category.
- Function: Fitting function name.
- Equation: The fitting function's equation.
- Offset Parameter: If existing function is used, this is a dropbox for selecting a particular parameter as the offset parameter. If you type in a new fitting function, this control will be a text box, and you should specify a particular parameter as the offset parameter.
- y(x) - offset: If you are defining a new function, enter the function expression here. Note that, the offset is specified in Offset Parameter text box, so the offset should not be included in your expression. For example, the if function you want to define is y(x)=A+B*x, then A is Offset Parameter, and B*x is the part to be assigned to the y(x) - offset control.
- This App requires function of every segment has an offset. If the piecewise funtion has no offset, it cannot be fit by this App. And this App cannot share parameters between different segment functions.
- Max Number of Iterations: Specify the maximum number of iterations to be performed.
- Tolerance: Specify the tolerance for the fitting.
- Quantities: Please refer to Quantities to Compute.
- Parameters Button: This button will open a dialog for setting parameter initial values.
- 1 Iter. Button: This button will perform 1 iteration of fitting.
- Fit Button: This button will carry out the iteration until the tolerance is reached, or the number of iterations has reached.