Matlab fitting image is inconsistent with the parametric equation
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I used the Curve Fitting Toolbox to make a polynomial (degree 3) . But Matlab fitting image is inconsistent with the parametric equation.
My data
year=[1750 1800 1850 1900 1950 1990 2000 2009];
population(millions)=[791 980 1260 1650 2520 5270 6060 6800];
cftool(year,population);
I want to forecast population in 1987.
if I find the point by image
the population is 4458
But if I used the results from the Curve Fitting Toolbox
f(x) = p1*x^3 + p2*x^2 + p3*x + p4
p1 = 0.001021
p2 = -5.604
p3 = 1.026e+04
p4 = -6.254e+06
when x=1980, f(x)=16281
as you can see 16281 is much bigger than 4458
I want to know why and how can I change it
THANK YOU!!!!!!!!!
0 comentarios
Respuestas (1)
Star Strider
el 20 de Jul. de 2021
Try this —
year=[1750 1800 1850 1900 1950 1990 2000 2009];
% population(millions)=[791 980 1260 1650 2520 5270 6060 6800];
population = [791 980 1260 1650 2520 5270 6060 6800]*1E+6;
f = fit(year(:), population(:), 'poly3')
figure
plot(f, year, population, 'p')
grid
hl = legend;
hl.Location = 'best';
text(1980, f(1980), sprintf('1980 Population (Est) = %4.0fx10^6 \\rightarrow', f(1980)*1E-6), 'Horiz','right', 'Vert','middle')
.
0 comentarios
Ver también
Categorías
Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!