matlab中关于符号向量的计算问题,求帮助clcclearu2=zeros(1,100);for i=1:101 u=sym('u',[1,101]);endfor i=1:100 b=sym('b',[1,100]); d=sym('d',[1,100]); a=sym('a',[1,100]);endu(1,1)=1;t=0:1:100;for i=1:100 b(1,i)=u(i+1)/2; d(1
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 19:24:59
matlab中关于符号向量的计算问题,求帮助clcclearu2=zeros(1,100);for i=1:101 u=sym('u',[1,101]);endfor i=1:100 b=sym('b',[1,100]); d=sym('d',[1,100]); a=sym('a',[1,100]);endu(1,1)=1;t=0:1:100;for i=1:100 b(1,i)=u(i+1)/2; d(1
matlab中关于符号向量的计算问题,求帮助
clc
clear
u2=zeros(1,100);
for i=1:101
u=sym('u',[1,101]);
end
for i=1:100
b=sym('b',[1,100]);
d=sym('d',[1,100]);
a=sym('a',[1,100]);
end
u(1,1)=1;
t=0:1:100;
for i=1:100
b(1,i)=u(i+1)/2;
d(1,i)=3^u(1,i);
a(1,i)=b(i)*d(i);
solve('u(1,i+1)-u(1,i)-a(1,i)','u(1,i+1)');
u2(i)=vpa(u(1,i+1));
end
u2
一下是运行时的问题:
Warning: 2 equations in 0 variables.
Warning: Explicit solution could not be found.
> In solve at 81
In Untitled at 18
? 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 ==> Untitled at 19
u2(i)=vpa(u(1,i+1));
matlab中关于符号向量的计算问题,求帮助clcclearu2=zeros(1,100);for i=1:101 u=sym('u',[1,101]);endfor i=1:100 b=sym('b',[1,100]); d=sym('d',[1,100]); a=sym('a',[1,100]);endu(1,1)=1;t=0:1:100;for i=1:100 b(1,i)=u(i+1)/2; d(1
clc % 改了下程序.还有问题,告诉我题目,我帮你编程.
clear
uu2=zeros(1,100);
u=sym('u',[1,101]) % 建符号矩阵
b=sym('b',[1,100]);
d=sym('d',[1,100]);
a=sym('a',[1,100]);
u(1,1)=1;
t=0:1:100;
for i=1:100 % 如果没猜错的话!
b(i)=u(i+1)/2;
d(i)=3^u(i);
a(i)=b(i)*d(i);
u(i+1) =solve(u(i+1)-u(i)-a(i),u(i+1));
uu2(i)=vpa(u(i+1));
end
uu2