matlab数据类型转换遇到问题,及解决办法,sym,double ,vpa转换
2015-08-15 16:15
721 查看
符号计算与数值计算混合使用是Matlab程序的大忌!
丧失了快速计算得优点!
变量精度计算
R = vpa(A, d)
the current setting of digits. Each element of the result is a symbolic expression_r.
R = vpa(A, d) uses d digits, instead of the current setting of digits.
R = vpa(A)利用变量精度计算方法以d为小数点精度去计算A中的每个元素,其中d是当前的小数点设置(digits).每个输出的元素是符号表达式.
R = vpa(A, d) 利用d为digits精度代替当前的digits设置.(其实就是小数点后的位数)
return
vpa pi 75 computes π to 75 digits.
The statements
return
丧失了快速计算得优点!
vpa
Variable precision arithmetic变量精度计算
Syntax
R = vpa(A)R = vpa(A, d)
Description
R = vpa(A) uses variable-precision arithmetic (VPA) to compute each element of A to d decimal digits of accuracy, where d isthe current setting of digits. Each element of the result is a symbolic expression_r.
R = vpa(A, d) uses d digits, instead of the current setting of digits.
R = vpa(A)利用变量精度计算方法以d为小数点精度去计算A中的每个元素,其中d是当前的小数点设置(digits).每个输出的元素是符号表达式.
R = vpa(A, d) 利用d为digits精度代替当前的digits设置.(其实就是小数点后的位数)
Examples
The statementsdigits(25) q = vpa(sin(sym('pi')/6)) p = vpa(pi) w = vpa('(1+sqrt(5))/2')
return
q = 0.5 p = 3.141592653589793238462643 w = 1.618033988749894848204587
vpa pi 75 computes π to 75 digits.
The statements
A = vpa(hilb(2),25) B = vpa(hilb(2),5)
return
A = [ 1.0, 0.5] [ 0.5, 0.3333333333333333333333333] B = [ 1.0, 0.5] [ 0.5, 0.33333]
matlab错误提示
The following error occurred converting from sym to double: Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a double array. If the input expression contains a symbolic variable, use the VPA function instead. Error in hRefinement2d (line 103) newprojcoord(wcpindex,:) = tempcontrolPoints;
相关文章推荐
- C++与Matlab的混合编程
- matlab中repmat函数的用法
- MATLAB中mexFunction函数的接口规范(转载)
- MATLAB中的cumsum()函数 计算一个数组各行的累加值
- Matlab:RandStream函数
- matlab 基础知识class < superclass_name
- 8-MATLAB绘图
- 6-使用MATLAB进行概率统计分析
- 4-MATLAB的矩阵运算
- 3-MATLAB基本运算
- 2-MATLAB数据类型
- matlab实现基于DFS的Ford_Fulkerson最大流最小割算法
- MATLAB字符串函数
- 在C、C++中调用Matlab
- Matlab与C/C++联合编程之Matlab以MEX方式调用C代码(五)完整过程加示
- Matlab中plot函数全功能解析
- Matlab中plot函数全功能解析
- 关于R画误差分析图——做到和MATLAB一样
- matlab/C混合编程--mex文件的编写、编译、调用
- Matlab与C/C++联合编程之Matlab以MEX方式调用C/C++代码(四)