Getting a vector for different x value

2 ビュー (過去 30 日間)
Mark Loui
Mark Loui 2021 年 3 月 26 日
回答済み: KALYAN ACHARJYA 2021 年 3 月 26 日
Hi there i need some help please, i like to create a x value. this x value is determine by halfing the xnew value
for example,
there is a line between a and b the width is 1. lets say
a=0;
b=1;
h=b-a/2 %This will the new xnew
n=0.01;
while the xnew < n
xnew=h/2 %the first line is juts b-a/2
%The second x new has two more new xnew, and it goes on for the other xnew.
for example once the first line is done, then is (b-a/2)/2 for the first xnew and inside the xnew there is also another which is the second half of the xnew between the previously determine xnew (b-a/2) and the 1 there, and this goes on and on until the while loop is satisfied
Can i have some help here please

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 3 月 26 日
Is this?
a=0;
b=1;
h=b-a/2;
n=0.01;
xnew=[];% Number of Iteration is not known
xnew(1)=h;
i=1;
while xnew(i)>n
xnew(i+1)=h/2;
h=h/2;
i=i+1;
end

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by