curve_fit
Perform curve fitting on worksheet data with a range of built-in functions. Returns fitted parameters and statistics including R-squared.
Instructions
Perform curve fitting on worksheet data.
Args: data_book: Source workbook name data_sheet: Source sheet name x_col: X column number (1-based) y_col: Y column number (1-based) function: Fitting function. Built-in options: line, poly2-5, exp1, exp2, expgrow1, expdecay1, gauss, lorentz, voigt, power, lognormal, logistic, boltzmann, hill, sine y_error_col: Y error column (1-based, 0=none) plot_on_graph: Optional name of an existing graph — the fitted curve is drawn on it as a line (paper style: data symbols + fit line). Also keeps the fit report sheets in the workbook.
Returns: JSON with fitted parameters (value + std_error) and statistics (r_squared, sum_sq_residuals, reduced_chi_sq, dof)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"data_book": "<data_book>",
"data_sheet": "<data_sheet>",
"x_col": "<x_col>",
"y_col": "<y_col>"
},
"name": "curve_fit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data_book | Yes | ||
| data_sheet | Yes | ||
| x_col | Yes | ||
| y_col | Yes | ||
| function | No | line | |
| y_error_col | No | ||
| plot_on_graph | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |