how to do a line progression of line trend.
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
jesus escareno
le 28 Déc 2017
Commenté : Star Strider
le 29 Déc 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.
0 commentaires
Réponse acceptée
Star Strider
le 28 Déc 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 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!