I want to make an iteration for all arras of my vector.
1 回表示 (過去 30 日間)
古いコメントを表示
Mohammad Sadegh Nasirianfar
2022 年 5 月 17 日
コメント済み: Mohammad Sadegh Nasirianfar
2022 年 5 月 18 日
n=ones(size(f_s));
C_n = (1./sigmaprimevo/10).^n;
Q= (q_c-sigmavo)*10.*C_n;
F= f_s./(q_c-sigmavo)*100;
I_c= real(((3.47-log10(Q)).^2+(1.22+log10(F)).^2).^0.5);
n(I_c<1.64)=.5;
n(I_c>1.64&I_c<3.3)=(I_c(I_c>1.64&I_c<3.3)-1.64)*.3+.5;
n(I_c>3.3)=1;
my code is as above. I want to assume 1 in the first step for all arrays of n. after that n has to be calculated considering the I_c values. This has to be continued till change in n less than 0.01 (deltan<0.01). how can I write that?
0 件のコメント
採用された回答
Jan
2022 年 5 月 17 日
n=ones(size(f_s));
ready = false;
while ~ready
nOld = n;
... Your code as above
ready = all((n - nOld) < 0.01)
% Or maybe: sum(abs(n - nOld) < 0.01
% or maybe: max(abs(b - nOld) < 0.01
% or what ever the criterion is
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Hamamatsu Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!