How can I recognize symbolic value with actual value 0?
2 次查看(过去 30 天)
显示 更早的评论
I was making some calculation and got symbolic value of
ans =
3/2 - (73^(1/2)/4 - 7/4)*(73^(1/2)/4 + 7/4)
it was actually 0, but matlab didn't recognize it. I used double(syms), but the result was
ans =
-4.5278e-72
how can I make matlab recognize it as 0?
0 个评论
采纳的回答
更多回答(1 个)
Paresh yeole
2020-5-3
You need to specify custom tolerance.
if abs(ans) < 1e-10
ans = 0;
end
You can specify your own tolerance instead of 1e-10.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!