matlab solve 解方程问题
globalbglobalnglobalyt1=0.1;t2=0.001;t3=0.005;t4=0.01;t5=0.05;t6=0.1;t7=0.002;t8=0.00...
global b
global n
global y
t1=0.1;
t2=0.001;
t3=0.005;
t4=0.01;
t5=0.05;
t6=0.1;
t7=0.002;
t8=0.006;
t9=0.07;
t10=0.1;
shizi1='b/n*((t1-y)^(b-1)+(t2-y)^(b-1)+(t3-y)^(b-1)+(t4-y)^(b-1)+(t5-y)^(b-1)+(t6-y)^(b-1)+(t7-y)^(b-1)+(t8-y)^(b-1)+(t9-y)^(b-1)+(t10-y)^(b-1))-(b-1)*((t1-y)^(-1)+(t2-y)^(-1)+(t3-y)^(-1)+(t4-y)^(-1)+(t5-y)^(-1)+(t6-y)^(-1)+(t7-y)^(-1)+(t8-y)^(-1)+(t9-y)^(-1)+(t10-y)^(-1))=0';
shizi2='-j/n+1/n^2*((t1-y)^b+(t2-y)^b+(t3-y)^b+(t4-y)^b+(t5-y)^b+(t6-y)^b+(t7-y)^b+(t8-y)^b+(t9-y)^b+(t10-y)^b)=0';
shizi3='n/b+(log(t1-y)+log(t2-y)+log(t3-y)+log(t4-y)+log(t5-y)+log(t6-y)+log(t7-y)+log(t8-y)+log(t9-y)+log(t10-y))-1/n*((t1-y)^b*log(t1-y)+(t2-y)^b*log(t2-y)+(t3-y)^b*log(t3-y)+(t4-y)^b*log(t4-y)+(t5-y)^b*log(t5-y)+(t6-y)^b*log(t6-y)+(t7-y)^b*log(t7-y)+(t8-y)^b*log(t8-y)+(t9-y)^b*log(t9-y)+(t10-y)^b*log(t10-y))=0';
[b,y,n]=solve(shizi1,shizi2,shizi3,b,y,n);
哪儿错了????
错误提示:
Error using mupadengine/feval (line 157)
MuPAD error: Error: ']' expected. [line 1, col 35]
Error in solve (line 160)
sol = eng.feval('symobj::solvefull',eqns,vars);
Error in disanti (line 17)
[a,d,f]=solve(shizi1,shizi2,shizi3,b,y, 展开
global n
global y
t1=0.1;
t2=0.001;
t3=0.005;
t4=0.01;
t5=0.05;
t6=0.1;
t7=0.002;
t8=0.006;
t9=0.07;
t10=0.1;
shizi1='b/n*((t1-y)^(b-1)+(t2-y)^(b-1)+(t3-y)^(b-1)+(t4-y)^(b-1)+(t5-y)^(b-1)+(t6-y)^(b-1)+(t7-y)^(b-1)+(t8-y)^(b-1)+(t9-y)^(b-1)+(t10-y)^(b-1))-(b-1)*((t1-y)^(-1)+(t2-y)^(-1)+(t3-y)^(-1)+(t4-y)^(-1)+(t5-y)^(-1)+(t6-y)^(-1)+(t7-y)^(-1)+(t8-y)^(-1)+(t9-y)^(-1)+(t10-y)^(-1))=0';
shizi2='-j/n+1/n^2*((t1-y)^b+(t2-y)^b+(t3-y)^b+(t4-y)^b+(t5-y)^b+(t6-y)^b+(t7-y)^b+(t8-y)^b+(t9-y)^b+(t10-y)^b)=0';
shizi3='n/b+(log(t1-y)+log(t2-y)+log(t3-y)+log(t4-y)+log(t5-y)+log(t6-y)+log(t7-y)+log(t8-y)+log(t9-y)+log(t10-y))-1/n*((t1-y)^b*log(t1-y)+(t2-y)^b*log(t2-y)+(t3-y)^b*log(t3-y)+(t4-y)^b*log(t4-y)+(t5-y)^b*log(t5-y)+(t6-y)^b*log(t6-y)+(t7-y)^b*log(t7-y)+(t8-y)^b*log(t8-y)+(t9-y)^b*log(t9-y)+(t10-y)^b*log(t10-y))=0';
[b,y,n]=solve(shizi1,shizi2,shizi3,b,y,n);
哪儿错了????
错误提示:
Error using mupadengine/feval (line 157)
MuPAD error: Error: ']' expected. [line 1, col 35]
Error in solve (line 160)
sol = eng.feval('symobj::solvefull',eqns,vars);
Error in disanti (line 17)
[a,d,f]=solve(shizi1,shizi2,shizi3,b,y, 展开
2个回答
展开全部
没有报错啊,结果是:
ans =
-((COH0^2*COHadd^2*Kb^4 + 2*COH0^2*COHadd*Kb^3 + 4*COH0^2*Cblg*Kb^3*N1 + 4*COH0^2*Cblg*Kb^3*N2 + 4*COH0^2*Cblg*Kb^3*N3 + 4*COH0^2*Cblg*K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2*Cblg^2*Kb^2*N3*N6 + 2*Cblg^2*Kb^2*N3*N7 + Cblg^2*Kb^2*N4^2 + 2*Cblg^2*Kb^2*N4*N5 + 2*Cblg^2*Kb^2*N4*N6 + 2*Cblg^2*Kb^2*N4*N7 + Cblg^2*Kb^2*N5^2 + 2*Cblg^2*Kb^2*N5*N6 + 2*Cblg^2*Kb^2*N5*N7 + Cblg^2*Kb^2*N6^2 + 2*Cblg^2*Kb^2*N6*N7 + Cblg^2*Kb^2*N7^2 + 2*Cblg*Kb*N1 + 2*Cblg*Kb*N2 + 2*Cblg*Kb*N3 + 2*Cblg*Kb*N4 + 2*Cblg*Kb*N5 + 2*Cblg*Kb*N6 + 2*Cblg*Kb*N7 + 1)^(1/2) - COHadd*Kb + Cblg*Kb*N1 + Cblg*Kb*N2 + Cblg*Kb*N3 + Cblg*Kb*N4 + Cblg*Kb*N5 + Cblg*Kb*N6 + Cblg*Kb*N7 - COH0*COHadd*Kb^2 + 1)/(2*(COH0*Kb^2 + Kb))
接着用subs函数代入数据就好了
望采纳,谢谢!
追问
我怎么一直都报错。另外,不是应该得出三个数的值吗?solve不是只是解方程的函数吗?subs函数怎么代入数据?
2014-09-01
展开全部
将前3行全局变量定义global b;global n;global y;
改为符号变量定义:syms b n y。
希望你的shizi表达式有意义。我的机子求解你的问题一直busy
改为符号变量定义:syms b n y。
希望你的shizi表达式有意义。我的机子求解你的问题一直busy
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询