Borrar filtros
Borrar filtros

How to create a sequence.

14 visualizaciones (últimos 30 días)
Lord Chinex
Lord Chinex el 23 de Jul. de 2014
Respondida: Morm My el 29 de Jul. de 2021
I need to create a vector that holds a sequence. In the sequence the previous number is multiplied by 2. The sequence could stop at a desired number lets say 256 (but it could be a bigger number). How would one go about this?
Example sequnce = 2,4,8,16,32,...,256. vector = [2;4;8;16;32;64;128;256]
vector =
2
4
8
16
32
64
128
256

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 23 de Jul. de 2014
v = 2.^(1:8).'
  5 comentarios
Sandie Nhatien Vu
Sandie Nhatien Vu el 5 de Ag. de 2016
Thanks a lot!
Simon Siu
Simon Siu el 5 de Feb. de 2020
how to you know that!!!!!!!!!!!!!!!?????

Iniciar sesión para comentar.

Más respuestas (1)

Morm My
Morm My el 29 de Jul. de 2021
thank you very much sir.

Categorías

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