How can I make the loop operation to give only 1 answer for each iteration? Here's my program that i tried out but it keeps giving me more than 2 answer of each iteration.
1 回表示 (過去 30 日間)
古いコメントを表示
f=0;
while f<0.1
f=f+0.0000001;
Re=10^((1/sqrt(f)+0.537)/1.930)/sqrt(f);
for x=25000:-5000:5000
if round(Re)==x
disp(f)
end
end
end
0 件のコメント
回答 (1 件)
KSSV
2022 年 1 月 21 日
f=0;
while f<0.1
f=f+0.0000001;
Re=10^((1/sqrt(f)+0.537)/1.930)/sqrt(f);
count = 0 ;
for x=25000:-5000:5000
if round(Re)==x && count == 0
count = count+1 ;
disp([count f])
end
end
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!