请用MATLAB解下面方程组.[r1,r2,a1,a2,B]=solve('670=(r1+1)*a1+(r2+1)*a2+2*160*cos(B)','sin(B)=(r2-r1)/160','1=r2/r1','a1+a2=2*pi','a1=pi-2*(r2-r1)/160')直接解出来结果是:r1 =0pir2 =pipia1 =pipia2 =-(pi-175)/pi-(pi-495)/piB =-(pi-175)/p
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 03:14:47
请用MATLAB解下面方程组.[r1,r2,a1,a2,B]=solve('670=(r1+1)*a1+(r2+1)*a2+2*160*cos(B)','sin(B)=(r2-r1)/160','1=r2/r1','a1+a2=2*pi','a1=pi-2*(r2-r1)/160')直接解出来结果是:r1 =0pir2 =pipia1 =pipia2 =-(pi-175)/pi-(pi-495)/piB =-(pi-175)/p
请用MATLAB解下面方程组.
[r1,r2,a1,a2,B]=solve('670=(r1+1)*a1+(r2+1)*a2+2*160*cos(B)','sin(B)=(r2-r1)/160','1=r2/r1','a1+a2=2*pi','a1=pi-2*(r2-r1)/160')
直接解出来结果是:
r1 =
0
pi
r2 =
pi
pi
a1 =
pi
pi
a2 =
-(pi-175)/pi
-(pi-495)/pi
B =
-(pi-175)/pi
-(pi-495)/pi
可是用手算的结果是a1=a2=pi,r1=r2=(175-pi)/pi,B=0
请用MATLAB解下面方程组.[r1,r2,a1,a2,B]=solve('670=(r1+1)*a1+(r2+1)*a2+2*160*cos(B)','sin(B)=(r2-r1)/160','1=r2/r1','a1+a2=2*pi','a1=pi-2*(r2-r1)/160')直接解出来结果是:r1 =0pir2 =pipia1 =pipia2 =-(pi-175)/pi-(pi-495)/piB =-(pi-175)/p
你的计算结果是没有错的.
solve()函数的解是按先字母顺序后数字顺序排列的,字母是先大写后小写.不能手动指定解的顺序.
改成如下形式即可.
[B,a1,a2,r1,r2]=solve('670=(r1+1)*a1+(r2+1)*a2+2*160*cos(B)','sin(B)=(r2-r1)/160','1=r2/r1','a1+a2=2*pi','a1=pi-2*(r2-r1)/160')
[B,a1,a2,r1,r2]也可以写成[B a1 a2 r1 r2],效果是一样的.
另外也想想你请教个问题:
我的6.5版本的MATLAB,运行你这代码提示“未定义变量pi”,我晕!
我的2010a版本倒不会提示“未定义变量pi”,但是计算出的结果全是数值解.
我知道2008a版本开始,其符号计算内核由MAPLE换成了Mupad(Mupad远次于MAPLE,很多积分都无法计算出结果.但是这是Mathworks和MAPLE商业竞争的后果,悲剧的用户.),不知道是不是这个原因,希望你告知你的MATLAB版本.