Azzera filtri
Azzera filtri

How to create a sequence.

48 visualizzazioni (ultimi 30 giorni)
Lord Chinex
Lord Chinex il 23 Lug 2014
Risposto: Morm My il 29 Lug 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

Risposta accettata

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

Accedi per commentare.

Più risposte (1)

Morm My
Morm My il 29 Lug 2021
thank you very much sir.

Community Treasure Hunt

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

Start Hunting!

Translated by