Is it possible to fit data to more than two independent variables using Curve Fitting Toolbox R2013b?
조회 수: 15 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2009년 7월 13일
편집: MathWorks Support Team
2014년 1월 15일
I would like to use Curve Fitting Toolbox to fit my data to more than two independent variables.
채택된 답변
MathWorks Support Team
2013년 10월 18일
The ability to fit data to more than two independent variables is not available in Curve Fitting Toolbox.
To work around this issue, you can generate your own objective function and use functions from Optimization Toolbox to fit your data to more than two variables.
However, if the multivariate function is linear in the coefficients you can construct a linear system and solve it.
For example, let us assume a polynomial described by the following equation,
F = a0 + a1 .* X + a2 .* Y + a3 .* Z + a4 .* X .* Z
If "X", "Y", "Z" , are the three independent variable vectors and "F" the dependent variable vector with your data, you can express this system of equations as
F = D * u
where
- "D" is a matrix you can define in MATLAB as
>> D = [ones(length(X), 1), X, Y, Z, X .* Z ]
(Note that the number of rows is equal to the number of points in your data and the number of columns is the number of coefficients in your particular polynomial)
- "F" is the vector with the dependent variable data
In this situation, the polynomial coefficients are represented by a vector
u = [a0; a1; a2; a3; a4].
You can use the Left Matrix Division operator "\" to find this vector of coefficients as
>> u = D \ F
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!