Simple array step sizing.

3 次查看(过去 30 天)
Jim Oste
Jim Oste 2015-2-26
回答: m m 2019-5-6
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!

采纳的回答

the cyclist
the cyclist 2015-2-26
One way:
N = 6;
0.5.^(0:N)

更多回答(1 个)

m m
m m 2019-5-6
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)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by