Borrar filtros
Borrar filtros

Best Fit Line for Parabola

66 visualizaciones (últimos 30 días)
Daniella Chait
Daniella Chait el 22 de Sept. de 2022
Editada: Torsten el 22 de Sept. de 2022
I am trying to make a best fit line for a negative parabola, but when I use polyfit(x,y,2) and plot it I get the following image. Any tips?
  1 comentario
Torsten
Torsten el 22 de Sept. de 2022
Editada: Torsten el 22 de Sept. de 2022
You try to fit a parabola to only one (x,y) point.
If this is what you want, your curve is correct since it passes through the point with 0 magnets.

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 22 de Sept. de 2022
Try something like this —
x = [0; 0.019; 0.036];
y = [0.015; 0.25; 0.05];
p = polyfit(x, y, 2)
p = 1×3
-670.3646 25.1053 0.0150
xv = linspace(min(x), max(x));
yv = polyval(p,xv);
figure
plot(x, y, 'o')
hold on
plot(xv, yv, '-r')
hold off
xlabel('x')
ylabel('y')
.

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by