Tolerance in mathematical comparison
    3 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Hey I have a problem, in my code I have this mathematical comparison: inf=(Ttot>=0).*(Ttot+(inp_u~=0).*Tm0+(inp_u~=1).*Te0>Te+Tm); the problem is that this inequality has a problem with small tolerances. When I calculate the comparison by hand, I come normally to an error of around 0.0001. This error is follow by a infeasible state in my code. Is there a possibility to add a tolerance to this inequality? This is only a part of the total feasibility statement. so it is not easily rewritten. Thank you in advance, Kind regards Ralf
0 件のコメント
採用された回答
  Image Analyst
      
      
 2013 年 5 月 13 日
        "inf" means infinity and you shouldn't assign it to some kind of weird mish-mash of logical expressions and multiplications. What is Ttot? Is it a double number? If so Ttot>=0 is a logical.
OK look at the next term: (Ttot+(inp_u~=0)). So what is inp_u? Is it a number? If so then inp_u~=0 is a logical (True or false). So then you're adding a number to a logical.
And then it just go on with all kinds of strange operations. I'm not sure of the class of any of these variables, and I don't know what you want to do. What are all these things: Ttot, inp_u, Tm0, Te0, Te, and Tm??? What are you trying to see is within a tolerance of something else? What are the two things, and what variable is the tolerance?
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
				Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!