Simple array step sizing.

2 vues (au cours des 30 derniers jours)
Jim Oste
Jim Oste le 26 Fév 2015
Réponse apportée : m m le 6 Mai 2019
I know this is probably easy to code but my mind just isn't running on all cylinders today. I need an array of given size to decrease by a half each element (eg: 1, 0.5, 0.25, 0.125, 0.0625 etc.). Thanks for the help!

Réponse acceptée

the cyclist
the cyclist le 26 Fév 2015
One way:
N = 6;
0.5.^(0:N)

Plus de réponses (1)

m m
m m le 6 Mai 2019
Hi,
I need to define a variable B(j)) in the half step. e.g i have the variables A(i) and B(j). So the loops are( for i =2:N and j=2:N .
And B(j)=A(i+1)-A(i)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by