Matrix Indexing for calculating slope
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Joshua Naumann
le 20 Sep 2020
Réponse apportée : David Hill
le 20 Sep 2020
Ive got 2, 31x1 matrices x and y to represent x and y points
Id like to calculate the slope of the data by using m = y2 - y1/x2 - x1 and average the slopes obtained
My question is how can i use the second and first value of data of both x and y to calculate the slope for each point throughout the whole data set
0 commentaires
Réponse acceptée
David Hill
le 20 Sep 2020
slope=diff(y)./diff(x);
averageSlope=sum(slope)/length(slope);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!