How can I get a right solution?

From the euqation expression,b is equal to c and both are equal to zero.However,the simulation result is inverse! I guess that is due to the numerical precision of "double".
What should I do to get right solution?
Thanks!
a = exp(-1i*2*pi/491520*8*10000)
a = 0.5211 - 0.8535i
b = 0.4*a-(a-0.6*a)
ans = -2.7756e-17
c = 0.5*a-(a-0.5*a)
ans = 0

回答(1 个)

Image Analyst
Image Analyst 2023-6-23

0 个投票

If 10^-17 is not close enough for zero, what precision do you need?
See the FAQ:
Maybe you should try the Symbolic Toolbox.

类别

帮助中心File Exchange 中查找有关 Mathematics and Optimization 的更多信息

产品

版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by