MATLAB中digits和vpa
digits:
DIGITS Set variable precision digits.
Digits determines the accuracy of variable precision numeric computations.
DIGITS, by itself, displays the current setting of Digits.
DIGITS(D) sets Digits to D for subsequent calculations. D is an
integer, or a string or sym representing an integer.
D = DIGITS returns the current setting of Digits. D is an integer.
See also vpa.
vpa:
VPA Variable precision arithmetic.
R = VPA(S) numerically evaluates each element of the double matrix
S using variable precision floating point arithmetic with D decimal
digit accuracy, where D is the current setting of DIGITS.
The resulting R is a SYM.
VPA(S,D) uses D digits, instead of the current setting of DIGITS.
D is an integer or the SYM representation of a number.
It is important to avoid the evaluation of an expression using double
precision floating point arithmetic before it is passed to VPA.
For example,
phi = vpa((1+sqrt(5))/2)
first computes a 16-digit approximation to the golden ratio, then
converts that approximation to one with d digits, where d is the current
setting of DIGITS. To get full precision, use unevaluated string or
symbolic arguments,
phi = vpa('(1+sqrt(5))/2')
or
s = sym('sqrt(5)')
phi = vpa((1+s)/2);
Additional examples:
vpa(pi,780) shows six consecutive 9's near digit 770 in the
decimal expansion of pi.
vpa(hilb(2),5) returns
[ 1., .50000]
[.50000, .33333]
See also double, digits.
Overloaded methods:
sym/vpa
如:若把b=vpa(0.1666)的结果转换为字符串,可以先将其转换为double类型,即double(b),再num2str(b),即得所需结果。
MATLAB中digits和vpa的更多相关文章
- Matlab中的数据类型
Matlab中有15种基本数据类型,主要是整型.浮点.逻辑.字符.日期和时间.结构数组.单元格数组以及函数句柄等. 1.整型:(int8:uint8:int16:uint16:int3 ...
- matlab中help所有函数功能的英文翻译
doc funname 在帮助浏览器中打开帮助文档 help funname 在命令窗口打开帮助文档 helpbrowser 直接打开帮助浏览器 lookfor funname 搜索某个关键字相关函数 ...
- MATLAB中的积分运算
MATLAB中计算一元函数的(不)定积分使用int函数. ①int(s)计算符号表达式s的不定积分 syms x;s = x^2;int(s) 计算x^2的不定积分. ②int(s,x)计算符号表达式 ...
- MATLAB中绘制质点轨迹动图并保存成GIF
工作需要在MATLAB中绘制质点轨迹并保存成GIF以便展示. 绘制质点轨迹动图可用comet和comet3命令,使用例子如下: t = 0:.01:2*pi;x = cos(2*t).*(cos(t) ...
- matlab 中 eps 的分析
eps(a)是|a|与大于|a|的最小的浮点数之间的距离,距离越小表示精度越高.默认a=1: 这里直接在matlab中输入:eps == eps(1)(true). 我们知道浮点数其实是离散的,有限的 ...
- matlab中patch函数的用法
http://blog.sina.com.cn/s/blog_707b64550100z1nz.html matlab中patch函数的用法——emily (2011-11-18 17:20:33) ...
- paper 121 :matlab中imresize函数
转自:http://www.cnblogs.com/rong86/p/3558344.html matlab中函数imresize简介: 函数功能:该函数用于对图像做缩放处理. 调用格式: B = i ...
- MATLAB中FFT的使用方法
MATLAB中FFT的使用方法 说明:以下资源来源于<数字信号处理的MATLAB实现>万永革主编 一.调用方法X=FFT(x):X=FFT(x,N):x=IFFT(X);x=IFFT(X, ...
- MATLAB中fft函数的正确使用方法
问题来源:在阅读莱昂斯的<数字信号处理>第三章离散傅里叶变换时,试图验证实数偶对称信号的傅里叶变换实部为偶对称的且虚部为零.验证失败.验证信号为矩形信号,结果显示虚部是不为零且最大幅值等于 ...
随机推荐
- [Daily] 2014-4-22
KEEP GOING Think more product when face difference Check value null when insert/remove/update/add ch ...
- Python学习笔记3-文件的简单操作
Python中的文件操作 Python中文件打操作离不开两个模块 os 和 shutil os:操作文件.目录: Python os模块包含普遍的操作系统功能.如果你希望你的程序能够与平台无关的话, ...
- OC中ARC forbids explicit message send of release错误(转)
ARC forbids explicit message send of'release' 很显然,是ARC的问题. 错误原因:在创建工程的时候点选了“Use Automatic Reference ...
- 使用Vitamio打造自己的Android万能播放器(6)——在线播放(播放列表)
前言 新版本的VPlayer由设计转入开发阶段,预计开发周期为一个月,这也意味着新版本的Vitamio将随之发布,开发者们可以和本系列文章一样,先开发其他功能.本章内容为"在线视频播放列表& ...
- vs快捷键
Ctrl+E,D ----格式化全部代码 Ctrl+A+K+FCtrl+E,F ----格式化选中的代码 Ctrl+K+FCTRL + SHIFT + B生成解决方案 Alt+B+B 或 F6 生成当 ...
- Entityframework 伪CodeFirst开发模式应用于Sqlite数据库
因为最近没有时间深入的研究EntityFramework的内部机制,所以具体的实现并不十分了解.微软最初的初衷是开发出一套通用的数据库访问逻辑,实现对Dal数据访问层的高度封装,其中就用到了工厂模式和 ...
- css3教程:弹性盒模型
Css3引入了新的盒模型——弹性盒模型,该模型决定一个盒子在其他盒子中的分布方式以及如何处理可用的空间.这与XUL(火狐使用的用户交互语言)相似,其它语言也使用相同的盒模型,如XAML .GladeX ...
- SQL SERVER中变量的定义、赋值与使用
本文面向对SQL SERVER中变量操作不熟悉的用户,希望能使他们在看完本文后能对变量操作有具体和全面的认识. 在学习SQL SERVER的过程中,很多时候需要对某些单独的值进行调试,这时就需 ...
- CentOS6.4下搭建hadoop2.2(64bit)注意事项
注:本文针对64位机器,32bit课直接tar -zxvf hadoop-2.2.0.tar.gz 解压配置即可. Step1:安装jdk(6以上版本) Step2:下载hadoop--->ht ...
- C#扩展方法的理解 (转)
“扩展方法使您能够向现有类型“添加”方法,而无需创建新的派生类型.重新编译或以其他方式修改原始类型.” 这是msdn上说的,也就是你可以对String,Int,DataRow,DataTable等这些 ...