I am having trouble with the if cycle.
    3 ビュー (過去 30 日間)
  
       古いコメントを表示
    
kontrl = 3.197442310920451e-14
if kontrl>=-10^-20 & kontrl<=10^-20
  a = 4
  else 
  a = 10
end
% "a = 4" should be.
2 件のコメント
採用された回答
  Walter Roberson
      
      
 2017 年 8 月 10 日
        No, that is not correct. "a=4" is given only for values that are in the range +/- 1/10^20 but your value is more than 3000000 times larger than the upper end of that, at roughly +3/10^14
2 件のコメント
  Walter Roberson
      
      
 2017 年 8 月 10 日
				a = zeros(1, 100);
for N = 1 : 100
  kontrl = randn(1,1) * 1E-20;
    if kontrl>=-10^-20 & kontrl<=10^-20
      a(N) = 4;
    else 
      a(N) = 10;
    end
  end
a
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Logical についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



