File Exchange > Data Analysis >    Piecewise Fit

Author:
OriginLab Technical Support
Date Added:
9/7/2016
Last Update:
4/25/2023
Downloads (90 Days):
843
Total Ratings:
14
File Size:
80 KB
Average Rating:
File Name:
Piecewise Fit.opx
File Version:
1.50
Minimum Versions:
License:
Free
Type:
App
Summary:

Fit two or three segments of a data plot with same or different fitting function.

Screen Shot and Video:
Description:

  • Purpose
    This app can be used to perform piecewise fit on data plotted in the graph.
    Features include:
    1. Two or three segments of the data
    2. Use different fitting functions, or same function, for each segment
    3. Option to fix or vary the X value of the segment intersection points
    4. Use built-in or user-defined fitting functions
    5. 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
    1. Select graph with a 2D scatter or line plot.
    2. Click the icon in the Apps Gallery window.
    3. In the pop up dialog, specify number of segments.
    4. Change or fix the X value of intersection points as needed.
    5. Choose a function for each segment, or assign same function to all segments.
    6. Change the max number of iterations and tolerance as needed.
    7. Select the desired output parameters and statistics.
    8. Click the Parameters button to provide initial parameters for user-defined functions.
    9. Click then 1 Iter. button to execute 1 iteration.
    10. 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.

Updates:

v1.5 4/25/2023 Updated to make it compatible with Origin 2023b.
v.14: Fixed bug for user-defined function
v1.3: Fixed bug for GaussMod function
v1.2: Fixed bugs for error checking
v1.1: Improved speed, and prompt dialog for fitting failed when clicking 1 Iter. button

Reviews and Comments:
10/31/2023jidaizongI need an app for the 2017 version of Piecewise Fit. How can I get it?

10/25/2023OriginLabHi 李鹏飞, could you please tell us the steps to reproduce this issue so that we can check? You can contact us by submitting a support ticket:
https://www.originlab.com/index.aspx?go=COMPANY/ContactUS

10/24/2023李鹏飞所有分段都选择了函数,但是一直提示需要设置函数,无法进行下一步拟合

02/19/2023leeweigood

10/18/2021  

06/08/20211749403253no bug.

06/08/20211749403253no bug

06/08/20211749403253no bug

06/08/20211749403253no bug

06/08/20211749403253no bug

12