How to create a sequence.

56 views (last 30 days)
Lord Chinex
Lord Chinex on 23 Jul 2014
Answered: Morm My on 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

Accepted Answer

Sean de Wolski
Sean de Wolski on 23 Jul 2014
v = 2.^(1:8).'
  5 Comments
Simon Siu
Simon Siu on 5 Feb 2020
how to you know that!!!!!!!!!!!!!!!?????

Sign in to comment.

More Answers (1)

Morm My
Morm My on 29 Jul 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!