Approximate Least Squares Curve Fitting (lsqcurvefit_approx​)

버전 2.0.6 (567 KB) 작성자: Tamas Kis
Fits linear and polynomial models to data using linear least squares and approximates nonlinear models through linearization.
다운로드 수: 494
업데이트 날짜: 2021/8/28

lsqcurvefit_approx View Approximate Least Squares Curve Fitting (lsqcurvefit_approx) on File Exchange

Fits linear and polynomial models to data using linear least squares and approximates nonlinear models through linearization.

Syntax

[c,r2,eqn] = lsqcurvefit_approx(x,y)
[c,r2,eqn] = lsqcurvefit_approx(x,y,'linear')
[c,r2,eqn] = lsqcurvefit_approx(x,y,'poly',n)
[c,r2,eqn] = lsqcurvefit_approx(x,y,'power')
[c,r2,eqn] = lsqcurvefit_approx(x,y,'exp')
[c,r2,eqn] = lsqcurvefit_approx(x,y,'log')

Description

[c,r2,eqn] = lsqcurvefit_approx(x,y) returns the model coefficient vector c = [m,b] for the linear fit to a data set defined by the vectors x (independent variable) and y (dependent variable).

[c,r2,eqn] = lsqcurvefit_approx(x,y,'linear') does the exact same thing as the syntax above.

[c,r2,eqn] = lsqcurvefit_approx(x,y,'poly',n) returns the model coefficient vector c = [a0,...,an] for the degree polynomial fit to a data set defined by the vectors x (independent variable) and y (dependent variable).

[c,r2,eqn] = lsqcurvefit_approx(x,y,'power') returns the model coefficient vector c = [a,b] for the power fit to a data set defined by the vectors x (independent variable) and y (dependent variable).

[c,r2,eqn] = lsqcurvefit_approx(x,y,'exp') returns the model coefficient vector c = [a,b] for the exponential fit to a data set defined by the vectors x (independent variable) and y (dependent variable).

[c,r2,eqn] = lsqcurvefit_approx(x,y,'log') returns the model coefficient vector c = [a,b] for the logarithmic fit to a data set defined by the vectors x (independent variable) and y (dependent variable).

NOTE: Additionally, for all the syntaxes, the coefficient of determination (r2) and a string (eqn) storing the fitted equation (for use in figure text with LaTeX interpreter) are also returned.

Additional Notes/Warnings:

  • Only the linear and polynomial fits are true linear least squares fits. The nonlinear fits (power, exponential, and logarithmic) are approximated through transforming the model to a linear form and then applying a least squares fit.
  • Taking the logarithm of a negative number produces a complex number. When linearizing, for simplicity, this function will take only the real part of the resulting complex numbers in the case that a negative data point has to be linearized. The resulting fit is typically poor, and a (slightly) better fit could be obtained by excluding those data points altogether.

Examples and Additional Documentation

  • See "EXAMPLES.mlx" or the "Examples" tab on the File Exchange page for examples.
  • See "Least_Squares_Curve_Fitting.pdf" (also included with download) for the technical documentation.

인용 양식

Tamas Kis (2024). Approximate Least Squares Curve Fitting (lsqcurvefit_approx) (https://github.com/tamaskis/lsqcurvefit_approx-MATLAB/releases/tag/v2.0.6), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2021a
R2017a 이상 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
2.0.6

See release notes for this release on GitHub: https://github.com/tamaskis/lsqcurvefit_approx-MATLAB/releases/tag/v2.0.6

2.0.5.0

See release notes for this release on GitHub: https://github.com/tamaskis/lsqcurvefit_approx-MATLAB/releases/tag/v2.0.5

2.0.4

See release notes for this release on GitHub: https://github.com/tamaskis/lsqcurvefit_approx-MATLAB/releases/tag/v2.0.4

2.0.3.0

See release notes for this release on GitHub: https://github.com/tamaskis/lsqcurvefit_approx-MATLAB/releases/tag/v2.0.3

2.0.2

See release notes for this release on GitHub: https://github.com/tamaskis/lsqcurvefit_approx-MATLAB/releases/tag/v2.0.2

2.0.1

See release notes for this release on GitHub: https://github.com/tamaskis/lsqcurvefit_approx-MATLAB/releases/tag/v2.0.1

2.0.0

See release notes for this release on GitHub: https://github.com/tamaskis/lsqcurvefit_approx-MATLAB/releases/tag/v2.0.0

1.0.10

See release notes for this release on GitHub: https://github.com/tamaskis/least_squares_fit-MATLAB/releases/tag/v1.0.10

1.0.9

See release notes for this release on GitHub: https://github.com/tamaskis/least_squares_fit-MATLAB/releases/tag/v1.0.9

1.0.8

See release notes for this release on GitHub: https://github.com/tamaskis/least_squares_fit-MATLAB/releases/tag/v1.0.8

1.0.7

See release notes for this release on GitHub: https://github.com/tamaskis/least_squares_fit-MATLAB/releases/tag/v1.0.7

1.0.6

See release notes for this release on GitHub: https://github.com/tamaskis/least_squares_fit-MATLAB/releases/tag/v1.0.6

1.0.5

See release notes for this release on GitHub: https://github.com/tamaskis/least_squares_fit-MATLAB/releases/tag/v1.0.5

1.0.4

See release notes for this release on GitHub: https://github.com/tamaskis/least_squares_fit-MATLAB/releases/tag/v1.0.4

1.0.3

See release notes for this release on GitHub: https://github.com/tamaskis/least_squares_fit-MATLAB/releases/tag/v1.0.3

1.0.2

See release notes for this release on GitHub: https://github.com/tamaskis/least_squares_fit-MATLAB/releases/tag/v1.0.2

1.0.1.0

See release notes for this release on GitHub: https://github.com/tamaskis/lsqcurvefit_approx-MATLAB/releases/tag/v1.0.1

1.0.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.