Effacer les filtres
Effacer les filtres

Vector Difference

2 vues (au cours des 30 derniers jours)
Mark
Mark le 24 Nov 2011
Given a vector x=[2 5 6 10 16 29].
Is there a one line command to create another vector that is the difference between the last elements (first element of x is first element of y)?
Example Output: y=[2 3 1 4 6 13]

Réponse acceptée

David Young
David Young le 24 Nov 2011
y = [x(1) diff(x)]
  1 commentaire
Mark
Mark le 24 Nov 2011
I appreciate the quick response. Excellant. Thankyou.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by