如何使用matlab求解一个二元二次方程组的问题?
程序如下:aF=0.8;af=-0.02;aB=-0.6;v0=12.26;T=104;S=1347.1;a1=aF+af;a2=af;a3=aB+af;[u,w]=so...
程序如下:
aF=0.8;
af=-0.02;
aB=-0.6;
v0=12.26;
T=104;
S=1347.1;
a1=aF+af;
a2=af;
a3=aB+af;
[u,w]=solve('(u-v0)/(aF+af)+(w-u)/af-w/(aB+af)==104','(u.^2-v0.^2)/(2*(aF+af))+(w.^2-u.^2)/(2*af)-w.^2/(2*(aB+af))==1347.1')
运行之后求解的结果提示错误,错误提示如下:
??? Error using ==> solve>getEqns at 182
' (u.^2-v0.^2)/(2*(aF+af))+(w.^2-u.^2)/(2*af)-w.^2/(2*(aB+af))==1347.1 ' is not a valid expression or equation.
Error in ==> solve at 67
[eqns,vars] = getEqns(varargin{:});
Error in ==> Untitled2 at 10
[u,w]=solve('(u-v0)/(aF+af)+(w-u)/af-w/(aB+af)==104','(u.^2-v0.^2)/(2*(aF+af))+(w.^2-u.^2)/(2*af)-w.^2/(2*(aB+af))==1347.1')
求大神指导,谢谢。 展开
aF=0.8;
af=-0.02;
aB=-0.6;
v0=12.26;
T=104;
S=1347.1;
a1=aF+af;
a2=af;
a3=aB+af;
[u,w]=solve('(u-v0)/(aF+af)+(w-u)/af-w/(aB+af)==104','(u.^2-v0.^2)/(2*(aF+af))+(w.^2-u.^2)/(2*af)-w.^2/(2*(aB+af))==1347.1')
运行之后求解的结果提示错误,错误提示如下:
??? Error using ==> solve>getEqns at 182
' (u.^2-v0.^2)/(2*(aF+af))+(w.^2-u.^2)/(2*af)-w.^2/(2*(aB+af))==1347.1 ' is not a valid expression or equation.
Error in ==> solve at 67
[eqns,vars] = getEqns(varargin{:});
Error in ==> Untitled2 at 10
[u,w]=solve('(u-v0)/(aF+af)+(w-u)/af-w/(aB+af)==104','(u.^2-v0.^2)/(2*(aF+af))+(w.^2-u.^2)/(2*af)-w.^2/(2*(aB+af))==1347.1')
求大神指导,谢谢。 展开
2个回答
展开全部
你有两点错误:
1、你给solve函数输入公式时是不用加单引号的 直接输入就行,加了单引号就变成字符串了,所以MATLAB说你是无效表达
2、在使用solve函数时u、w是两个符号变两,应该先定义:syms u w
程序应改为:
syms u w
aF=0.8;
af=-0.02;
aB=-0.6;
v0=12.26;
T=104;
S=1347.1;
a1=aF+af;
a2=af;
a3=aB+af;
[Su,Sw]=solve((u-v0)/(aF+af)+(w-u)/af-w/(aB+af)==104,(u.^2-v0.^2)/(2*(aF+af))+(w.^2-u.^2)/(2*af)-w.^2/(2*(aB+af))==1347.1)
为了与符号变量u、w相区别,方程解应该重新命名
满意请采纳~☆⌒(*^-゜)v THX!!
1、你给solve函数输入公式时是不用加单引号的 直接输入就行,加了单引号就变成字符串了,所以MATLAB说你是无效表达
2、在使用solve函数时u、w是两个符号变两,应该先定义:syms u w
程序应改为:
syms u w
aF=0.8;
af=-0.02;
aB=-0.6;
v0=12.26;
T=104;
S=1347.1;
a1=aF+af;
a2=af;
a3=aB+af;
[Su,Sw]=solve((u-v0)/(aF+af)+(w-u)/af-w/(aB+af)==104,(u.^2-v0.^2)/(2*(aF+af))+(w.^2-u.^2)/(2*af)-w.^2/(2*(aB+af))==1347.1)
为了与符号变量u、w相区别,方程解应该重新命名
满意请采纳~☆⌒(*^-゜)v THX!!
追问
谢谢回答,可是按照您更正后的程序运行又出现了新的问题,如下:
??? Error using ==> char
Conversion to char from logical is not possible.
还麻烦您看一下。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
aF=0.8;
af=-0.02;
aB=-0.6;
v0=12.26;
T=104;
S=1347.1;
a1=aF+af;
a2=af;
a3=aB+af;
[u,w]=solve('(u-v0)/(aF+af)+(w-u)/af-w/(aB+af)=104',...
'(u^2-v0^2)/2*(aF+af)+(w^2-u^2)/2*af-w^2/2*(aB+af)=1347.1','u,w');
u = subs(u)
w = subs(w)
u =
44.7261
-42.5912
w =
44.9278
-47.6136
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询