Curve Fitter tool-Center and scale
조회 수: 47 (최근 30일)
이전 댓글 표시
I am using the matlab Curve Fitter tool. I don't know what means the button "Center and scale". Can you explain? I tried to use it and sometimes the fitting seems to improve in quality. When I use it, it appears the phrase "where x is normalized by mean ** and std *** ". Should I scale also the resulting coefficient?
댓글 수: 0
채택된 답변
Steven Lord
2023년 2월 15일
Suppose you wanted to fit a quadratic curve to the census data set.
format longg
load census
plot(cdate, pop, 'o-')
Let's build the coefficient matrix.
A = [cdate.^2, cdate.^1, cdate.^0]
The elements of A vary in magnitude from 1 to nearly 4 million.
[minValue, maxValue] = bounds(A, 'all')
cond(A)
By the rule of thumb cited on that Wikipedia page, "As a rule of thumb, if the condition number is , then you may lose up to k digits of accuracy on top of what would be lost to the numerical method due to loss of precision from arithmetic methods."
What if we centered and scaled the date data and used the centered and scaled data in the construction of A?
normalizedCdate = normalize(cdate, 'zscore');
Normalizing using 'zscore' (the default) results in normalized data with mean 0 and standard deviation 1.
mean(normalizedCdate) % close enough to 0
std(normalizedCdate)
If we build the coefficient matrix with this data:
A2 = normalizedCdate.^[2 1 0]
the range of elements is much smaller:
[minValue, maxValue] = bounds(A2, 'all')
This matrix is much better conditioned.
cond(A2)
log10(cond(A2))
Instead of losing 9 digits of accuracy we're losing less than half a digit.
coefficients1 = A\pop
coefficients2 = A2\pop
Note that we could be required to multiply a number near 4 million by a small number (0.0065...) if we want to use coefficients1 to evaluate the fit. If we want to use coefficients2 we're multiplying a number between say -2 and 2.5 by 25.1833....
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!