如何让fprintf显示更高的精度?

use*_*182 1 matlab printf

我正在尝试使用以下 fprintf 代码

      n
      m
     fprintf('The minimum value of the modulus of the image of C_r is %d \n\nThe correspoding point is at %d \n\n',m,n)
Run Code Online (Sandbox Code Playgroud)

我得到了结果

  n =

  3.632213809443102 + 3.680287679864827i


m =

   5.170831128945713

The minimum value of the modulus of the image of C_r is 5.170831e+000 

The correspoding point is at        3.632214e+000 
Run Code Online (Sandbox Code Playgroud)

我分别打印了 n 和 m 的值,以显示我希望它们如何显示 - 如何让 fprintf 以更高的精度显示数字?我尝试更改 %d 条款但无济于事

Sha*_*hai 5

怎么样

fprintf( '%.15f\n', m );
Run Code Online (Sandbox Code Playgroud)

打印15位数字

  • 也许: `fprintf('%.15f + %.15fi\n',real(z),imag(z))` (5认同)
  • 如果您不喜欢看到“0.1 + -0.2i”(加号然后减号),您可以使用“%.15f %+.15fi\n”代替作为格式字符串 (5认同)