MATLAB符号表达式赋值问题!syms x;A=zeros(9,9);B=[x^5,x^3,x;3*x^2,4,7*x^4;5,7,1]; A(1:3,1:3)=B;可以实现,但A(1:3,1:3)=A(1:3,1:3)+B;就不行,错误报告如下:The following error occurred converting from sym to double:Error using ==> mu
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 21:16:10
MATLAB符号表达式赋值问题!syms x;A=zeros(9,9);B=[x^5,x^3,x;3*x^2,4,7*x^4;5,7,1]; A(1:3,1:3)=B;可以实现,但A(1:3,1:3)=A(1:3,1:3)+B;就不行,错误报告如下:The following error occurred converting from sym to double:Error using ==> mu
MATLAB符号表达式赋值问题!
syms x;
A=zeros(9,9);B=[x^5,x^3,x;3*x^2,4,7*x^4;5,7,1];
A(1:3,1:3)=B;可以实现,但
A(1:3,1:3)=A(1:3,1:3)+B;就不行,错误报告如下:
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.
MATLAB符号表达式赋值问题!syms x;A=zeros(9,9);B=[x^5,x^3,x;3*x^2,4,7*x^4;5,7,1]; A(1:3,1:3)=B;可以实现,但A(1:3,1:3)=A(1:3,1:3)+B;就不行,错误报告如下:The following error occurred converting from sym to double:Error using ==> mu
我这里matlab试的时候,A(1:3,1:3)=A(1:3,1:3)+B;也不能实现.
原因是A是double类型的,而B是sym类型的.
A没能够实现强制转换.
可以这样:
A1= A(1:3,1:3);
A1=B;
A1=A1+B;