Borrar filtros
Borrar filtros

Vector Difference

2 visualizaciones (últimos 30 días)
Mark
Mark el 24 de Nov. de 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]

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by