>> [x,y] = solve('(5/6)*(1+x)^3-(10/6)*(2.5+x)^3+0.09*x^3+29.069*x^2+4.03x+2.248+y*((2.8+x)^2/(2.2+x))*0.94+y*(2.2+x)=0','2.5*(1+x)^2-5*(2.5+x)^2+0.274x^2+58.148x+4.03+y*((y+2.8)/(2.2+x))*0.96+y=0')

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 07:53:07

>> [x,y] = solve('(5/6)*(1+x)^3-(10/6)*(2.5+x)^3+0.09*x^3+29.069*x^2+4.03x+2.248+y*((2.8+x)^2/(2.2+x))*0.94+y*(2.2+x)=0','2.5*(1+x)^2-5*(2.5+x)^2+0.274x^2+58.148x+4.03+y*((y+2.8)/(2.2+x))*0.96+y=0')
>> [x,y] = solve('(5/6)*(1+x)^3-(10/6)*(2.5+x)^3+0.09*x^3+29.069*x^2+4.03x+2.248+y*((2.8+x)^2/(2.2+x))*0.94+y*(2.2+x)=0','2.5*(1+x)^2-5*(2.5+x)^2+0.274x^2+58.148x+4.03+y*((y+2.8)/(2.2+x))*0.96+y=0')

>> [x,y] = solve('(5/6)*(1+x)^3-(10/6)*(2.5+x)^3+0.09*x^3+29.069*x^2+4.03x+2.248+y*((2.8+x)^2/(2.2+x))*0.94+y*(2.2+x)=0','2.5*(1+x)^2-5*(2.5+x)^2+0.274x^2+58.148x+4.03+y*((y+2.8)/(2.2+x))*0.96+y=0')
分析
首先,恕我冒昧,这程序真的是你写的?
如果是,这么简单的问题不应该看不出来啊.

1、之所以【运行时会出现? Undefined function or variable 'x1'.】,是因为程序中x1(还包括x2 x3 x4 x5)在使用的时候确实未定义.用到x1的最靠前的代码是:
x=[x1;x2;x3;x4;x5];你可以看看,前面有x1定义吗?

2、之所以【加入一个syms x1 x2 x3 x4 x5;再运行,会提示? Function 'norm' is not defined for values of class 'sym'.】,是因为求范数的函数norm对sym类型没有定义,而你用syms命令定义x1-x5是sym类型,进而x、再进而d都是sym类型,对d求范数当然会出错.

3、之所以【然后再次用原程序运行(无syms的)就可以正常算出来了】,是因为你前面加了syms命令后,尽管执行到norm的时候出错,但在此之前,已经执行了下面这一行:
x1=0;x2=0;x3=0;x4=0;x5=0;这样你再次运行的时候,x1-x5都已经定义,当然就不会出现第一个错了;而此时x和d也不再是sym类型,求范数没问题,也就不会出现第二个错了.

修改
经过上面的分析,相信你应该知道怎么修改了,对,没错,就是把这一句
x1=0;x2=0;x3=0;x4=0;x5=0;移到
x=[x1;x2;x3;x4;x5];的前面就可以了.
请采纳.

常微分solve the equation(x+4y)y'=2x+3y+5 solve the problems4^x-8^y=03^(X+1).9^(-y)=1 solve that,{x+y=100 {0.9x+1.4y=100×(1+0.2) Solve the system by the substitution method,and identify the value of x of the solution.2x - 5y = 3y = -2x + 1 Solve for y in terms of x:(a).x² - 2xy + y² = 4(b).(x+y)/(x-y) = 5(c).x = √(y² - 2y) Matlab中solve函数的特殊应用y=f(x);solve('y=0','x');因为f(x)非常复杂,需要定义几个函数.那么用solve的时候如何实现呢? Solve EquationsSolve :1/p + 1/q = 1/f for qSolve for y in terms of x:3x - 5y = 8 matlab 符号方程组怎么求这个方程组啊?>> syms x y z;>> [x,y,z]=solve('sin(x)+y^2+logz=9','sin(x)+2^y-z=6','x^2+y+exp(x)=5')? Error using ==> solve at 162Unable to find closed form solution.这怎么回事啊? matlab中,定义了y='x+1',如果调用solve(‘eq1’,即要求solve('x+1=0','x'). matlab 运用solve函数,做一个gui,或用其他函数也成,我做不出来,输入a ,b的值后按计算按钮得到x ,y的值.a b x y 的关系为[x y ]=solve('x^2=a*y+5*b','y=10*a+x'), >> [x,y] = solve('(5/6)*(1+x)^3-(10/6)*(2.5+x)^3+0.09*x^3+29.069*x^2+4.03x+2.248+y*((2.8+x)^2/(2.2+x))*0.94+y*(2.2+x)=0','2.5*(1+x)^2-5*(2.5+x)^2+0.274x^2+58.148x+4.03+y*((y+2.8)/(2.2+x))*0.96+y=0') use elimination to solve each system of equations 例子:X- Y= 1 X + Y= 3 and 3x-y=26 -2x-y= -24 matlab中解方程组syms x y z t[x,y,z,t]=solve(2*x+3*y-z+t-2,5*x+y+z-t-13,x-y+2*z+2*t-3,3*x+2*y+2*z+9*t+3)结果:x =-2y =1z =2t =4结果是不对的.做了如下调整:syms x y z t[t,x,y,z]=solve(2*x+3*y-z+t-2,5*x+y+z-t-13,x-y+2*z+2*t-3,3*x+2*y+2 matlab用solve解方程syms x y c en fai;[x,y]=solve('log(y.*(1-x)/(x.*(1-y)))+en','y.*(1-c.*sum((k.*(y./x).^k)/sum(((y./x).*exp(en-2.*pi)).^k)))+x.*c.*sum((k.*(y./x).^k/sum(((y./x)*exp(en-2.*pi)).^k))-fai')Error using ==> solve' log(y.*(1-x)/(x.*(1- matlab解方程的一个小问题 >> syms x >> k=5 k = 5 >> y='x+k=0' y = x+k=0 >> solve(y) ans =-k>> syms x >> k=5 k = 5 >> y='x+k=0' y = x+k=0>> solve(y) ans =-k 答案求得不是-5,而是-k,要怎么将得到的变成-5呢,解的方程里面一 matlab新手求解3:solve函数.我输入solve('x^3+5*x-8'),结果求得三个解:.我只想使用第一个解,如何将其从solve()中提取出来.输入[a b c ]=solve('x^3+5*x-8')时matlab报错,查了资料才知道solve函数的返回值 如何用matlab解二元方程[x,y]=solve('1351.565-14.85*13-379.25*x-1.025*y.^2-27.25*y = 0','222.5-2.7*13-27.75*x-0.45*y.^2-2.05*x*y-0.36*13*y=0','x','y')Error using ==> solve>getEqns at 182' 1351.565-14.85*13-379.25*x-1.025*y.^2-27.25*y = 0 ' is n matlab solve解符号函数问题为什么用solve函数可以解出【log(x)=c'】,解不出【b*(a+x)*log(x)=c】的x值?如何解>> solve('5*(60+x)*log(x)=10')ans =1.0333118065736867150074014102319>> solve('b*(a+x)*log(x)=c')Error using ==> solveU