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 visualizzazione (ultimi 30 giorni)
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

Risposte (1)

KSSV
KSSV il 21 Gen 2022
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

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by