How can I make a vector divide 1 by increasing numbers?

2 visualizaciones (últimos 30 días)
Seba.V
Seba.V el 21 de Jul. de 2019
Comentada: Seba.V el 21 de Jul. de 2019
how can I generate a vector with values 1,1/2,1/3...1/10?

Respuesta aceptada

Guillaume
Guillaume el 21 de Jul. de 2019
v = 1 ./ (1:10)
  6 comentarios
Guillaume
Guillaume el 21 de Jul. de 2019
No, that only gives me a value of 10.
You could at the very least try the answers you are given, otherwise we're not going to go very far...
Seba.V
Seba.V el 21 de Jul. de 2019
Sorry, I was mistaking with spaces between characters..:/ all answers work. Thank you everyone!!

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 21 de Jul. de 2019
i = 1;
while i <= 10
v(i) = 1./i;
i = i + 1;
end

Categorías

Más información sobre Function Creation 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