Curve Fitter tool-Center and scale
47 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
SYML2nd
am 15 Feb. 2023
Beantwortet: Steven Lord
am 15 Feb. 2023
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 Kommentare
Akzeptierte Antwort
Steven Lord
am 15 Feb. 2023
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!