Matlab中显示精度的函数

来源:互联网 发布:提花软件 编辑:程序博客网 时间:2024/05/09 10:41

Matlab中可以设置显示精度的函数有三个:format、vpa、digits

示例:

>> x=1/3


x =


    0.3333


>> format   long;    %设置为long显示精度
>> x=1/3


x =


   0.333333333333333


>> format    rational;    %显示为小数形式
>> x=1/3


x =


       1/3     


>> digits(10);     %显示10位有效数字

>> vpa(1/3)
 
ans =
 
0.3333333333
 
>> vpa(100/3,20)  %显示20位有效数字
 
ans =
 
33.333333333333333333
 

0 0
原创粉丝点击