how can i found the best linear function representing the following points ???

1 visualización (últimos 30 días)
x=[ 0 0.6 1.2 1.8 2.4 2.8 ]
f(x)=[ 1.1 2.5 4.9 6.4 9.3 14.1 ]

Respuesta aceptada

Star Strider
Star Strider el 12 de Jul. de 2020
Try this:
x=[ 0 0.6 1.2 1.8 2.4 2.8 ]
fx=[ 1.1 2.5 4.9 6.4 9.3 14.1 ]
B = [x(:) ones(size(x(:)))] \ fx(:); % Estimate Parameters
Slope = B(1)
Intercept = B(2)
FitLine = [x(:) ones(size(x(:)))] * B;
figure
plot(x, fx, 'p')
hold on
plot(x, FitLine, '-r')
hold off
grid
A linear fit may not be entirely appropriate, becausse there is an obvious trend in the residuals.
.

Más respuestas (0)

Categorías

Más información sobre MATLAB 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!

Translated by