how to do a line progression of line trend.

10 visualizaciones (últimos 30 días)
jesus escareno
jesus escareno el 28 de Dic. de 2017
Comentada: Star Strider el 29 de Dic. de 2017
So i have a line plot from an two arrays X = [52.5, 81.25, 86.25, 106.5]; and Y= [787.5, 1228.13, 1361.25, 1796.26, 1233.75];. How am I able to map their progression if the trend where to keep on going.

Respuesta aceptada

Star Strider
Star Strider el 28 de Dic. de 2017
First, you cannot, because your ‘X’ vector is (1x4) and your ‘Y’ vector is (1x5). Deleting the last element of ‘Y’, fitting a linear model, and extrapolating, try this:
X = [52.5, 81.25, 86.25, 106.5];
Y= [787.5, 1228.13, 1361.25, 1796.26];
B = [X(:) ones(size(X(:)))]\Y(:);
Xv = linspace(-100, 250);
Yv = [Xv(:), ones(size(Xv(:)))] * B;
figure(1)
plot(X, Y, 'pg')
hold on
plot(Xv, Yv, '-r')
hold off
grid
  4 comentarios
jesus escareno
jesus escareno el 29 de Dic. de 2017
Okay I got it. Does clarify how the whole code works.
Thanks.
Star Strider
Star Strider el 29 de Dic. de 2017
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by