在我的程序中,假设我没有修复。用户N=6
。
SIR SIRo=6
的阈值;生成的输出为SIRmean=10
(假设)。
我想制作一个循环以便
if SIRmean < SIRo
disp N=6
else
decrease the counter till SIRmean> SIRo
and display the value of N for which this condition holds true.
end
答案 0 :(得分:0)
你可以使用简单的for循环与downcounter并在条件下中断:
N=6;
for k=N:-1:0
SIRmean = calc_SIR_mean(N);
if SIRmean < SIRo
disp(['N=' k])
break;
end
end
函数calc_SIR_mean
应根据用户数返回平均值(从您的问题中不清楚如何获得此值)。