h****e 发帖数: 216 | | a****l 发帖数: 8211 | 2 it's the display problem, not calculation problem.
【在 h****e 的大作中提到】 : 我计算的结果都是0.0001之类的 : 谢谢
| k**f 发帖数: 372 | 3
Some values, such as 0.1, cannot be represented precisely in binary. So if
you add 0.1 10 times and expecting the sum to be exactly 1, then you will be
disappointed.
If in your application, you know that the imaginary part of the complex is
zero in theory, you can cast the values to real value and dump the minuscule
imaginary part.
One such example is that when you take fft of a real signal in MATLAB, and
then take ifft of the spectrum, you can hardly get a result that all the
imaginary part of
【在 h****e 的大作中提到】 : 我计算的结果都是0.0001之类的 : 谢谢
| c******r 发帖数: 132 | 4 I agree, "format long" will give more significant digits.
【在 a****l 的大作中提到】 : it's the display problem, not calculation problem.
| h****e 发帖数: 216 | 5 thanks。
"format long" works. |
|