matlab精度控制
2014-09-18 15:55
211 查看
转载请注明出处:http://blog.csdn.net/yf210yf
1.数值型 roundn—任意位位置四舍五入
其中roundn函数功能如下:
y = ROUNDN(x) rounds the input data x to the nearest hundredth. %不指定n,精确到百分位
y = ROUNDN(x,n) rounds the input data x at the specified power %精确到小数点后指定位数n
2.符号型
必须说明:vpa命令不能识别整数与小数,只算总位数,因此对它来说小数整数无论哪个都占一位,例如对9.3154保留两位小数时就得写成:
其中b为符号型变量;
3.字符型
其中b为字符型变量。
Format命令
控制显示模式,直到下一个format出现前,这条format命令一直有效。
1.数值型 roundn—任意位位置四舍五入
>>a=123.4567890; >>a=roundn(a,-4) a = 123.4568
其中roundn函数功能如下:
y = ROUNDN(x) rounds the input data x to the nearest hundredth. %不指定n,精确到百分位
y = ROUNDN(x,n) rounds the input data x at the specified power %精确到小数点后指定位数n
2.符号型
digits(4) vpa(....)
必须说明:vpa命令不能识别整数与小数,只算总位数,因此对它来说小数整数无论哪个都占一位,例如对9.3154保留两位小数时就得写成:
>>a=9.3154; >>digits(3) >>b=vpa(a) b= 9.32
其中b为符号型变量;
3.字符型
>>a=12.34567; >>b = sprintf('%8.2f',a) b = 12.35
其中b为字符型变量。
Format命令
控制显示模式,直到下一个format出现前,这条format命令一直有效。
相关文章推荐
- 如何控制matlab中的数据输出格式? 改变输出位数精度
- MATLAB控制运算精度
- matlab控制运算精度函数digits(A)和vpa(B)的使用方法
- matlab控制运算精度函数digits(A)和vpa(B)的使用方法
- matlab控制运算精度函数digits(A)和vpa(B)的使用方法
- MATLAB控制运算精度
- MATLAB数据精度控制
- Matlab控制精度
- Matlab digits与vpa 控制运算精度
- Matlab------------GUI编程:控制运算精度
- Matlab如何真正自如的控制legend(转!!!!)
- matlab 数据存储成excel文件时的精度问题
- 关于C++的cout输出小数的精度控制
- matlab控制图像的边界(margin),subplot的间距(gap)
- Matlab------如何控制matlab中的数据输出格式
- c++中控制输出精度的几种方式
- Poj 2350 Above Average(精度控制)
- Matlab预测控制工具箱设计实例
- Java中sleep的控制精度问题以及深入理解
- uva10341二分法解方程 精度控制