How to create a sequence.

9 Ansichten (letzte 30 Tage)
Lord Chinex
Lord Chinex am 23 Jul. 2014
Beantwortet: Morm My am 29 Jul. 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

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Morm My
Morm My am 29 Jul. 2021
thank you very much sir.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by