フィルターのクリア

execute a loop until the condition is met

2 ビュー (過去 30 日間)
Dominika
Dominika 2014 年 4 月 18 日
編集済み: Mischa Kim 2014 年 4 月 18 日
Hi,
I want to find a value 'f' for which formulas A and B are equal using a loop. Part of my code:
deltaTL=14.48
m1=7.89
m2=8.89
d=0.06
for f=1:0.1:5000;
A=20*log10(m1+m2)+20*log10(f)-48+deltaTL
A_ceil=ceil(A)
B=20*log10(m1*f)-48 + 20*log10(m2*f)-48+20*log10(f*d)-29
B_ceil=ceil(B)
if (A_ceil==B_ceil)
fb=f
break
else
return
end
end
I want to use 'return' to actually return to the line where the loop 'for' starts.
Please help,
Thanks, Dominika

回答 (1 件)

Mischa Kim
Mischa Kim 2014 年 4 月 18 日
編集済み: Mischa Kim 2014 年 4 月 18 日
Dominika, if you want to simply continue the loop if the if-condition is not met then simply remove the else-condition part, that is, get rid of
else
return

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by