Effacer les filtres
Effacer les filtres

Is it possible to use : operator to create a sequence which has a power of 2 increase step?

2 vues (au cours des 30 derniers jours)
I want to create a sequence of numbers that increase by power of two: 4 8 16 32 64 128 256 . Is it possible to do it with a colon operator, similarly to how I would create a sequence from 2 to 8 with a step increase of 2 (ie. 2 4 6 8) using A= 1:2:8?
Thank you!

Réponse acceptée

Matt J
Matt J le 18 Jan 2023
Modifié(e) : Matt J le 18 Jan 2023
2.^(2:8)
ans = 1×7
4 8 16 32 64 128 256

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by