FitData1D#
- class FitData1D(rawData)#
Bases:
FitDataFitData1Dabstract base for one-dimensional data fitting.Extends
FitDatato provide specialized functionality for fitting functions to 1D data (x,y coordinate pairs). Includes plotting capabilities and fit evaluation methods (evaluateFit()).Example1:
% Create and perform a 1D fit x = linspace(0, 10, 100); y = 2*exp(-(x-5).^2/2) + 0.1*randn(size(x)); data = [x', y']; fitObj = GaussianFit1D(data); fitObj.do(); fitObj.plot();
Example2:
% Evaluate fit at specific points fitObj = LinearFit1D(data); fitObj.do(); xEval = [1, 2, 3, 4, 5]; yEval = fitObj.evaluateFit(xEval);
- Constructor Summary
- Property Summary
- DataSize (1,1) double#
Number of data points
- FitPlotData (:,2) double#
n * 2 array for plotting fit curve
- Method Summary
- checkData(rawData)#
Validate input data format for 1D fitting.
- Parameters:
rawData (
double array) – Input data to validate- Returns:
Validated data or empty array
- Return type:
double array
- do()#
Perform the fitting operation.
- Returns:
Self-reference for method chaining
- Return type:
FitData1D
- evaluateFit(x)#
Evaluate the fitted function at specified x values.
- Parameters:
x (
double array) – x-coordinates for evaluation- Returns:
y-values from fitted function
- Return type:
double array
- plot(targetAxes, isRender)#
Plot raw data and fit curve.
- Parameters:
targetAxes (
axes handle) – Target axes for plotting (optional)isRender (
logical) – Whether to render axis labels and formatting
Example:
fitObj.plot(); fitObj.plot(gca, false);