Tolerance in mathematical comparison
4 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Image Analyst
on 13 May 2013
"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 Comments
More Answers (1)
See Also
Categories
Find more on Sparse Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!