vpa函数有两种语法格式:
vpa(x)
vpa(x,d)
下面是MATLAB帮助文档上的解释:
vpa(
uses variable-precision floating-point arithmetic (VPA) to evaluate each element of the symbolic input x
)x
to at least d
significant digits, where d
is the value of the digits
function. The default value of digits
is 32.
vpa(
uses at least x
,d
)d
significant digits, instead of the value of digits
.
从上述描述大概知道,vpa(x)需要配合函数digits实用,实用digits来设定精度值。
例如:
>> doc vpa
>> digits(3)
>> vpa(pi)
ans =
3.14
我们也可以使用第二种语法格式来设定精度,例如:
>> vpa(pi,5)