作业帮 > 综合 > 作业

matlab初学者想高手请教个问题哈:

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/23 00:06:08
matlab初学者想高手请教个问题哈:
x03^2=(x02*sin(x2)-x04*sin(x1+x2)-x05)^2+(x02*cos(x2)-x04*cos(x1+x2))^2;sin(x1)*(sqrt(x01^2+x02^2-2*x01*x02*cos(x2)))=sin(x2)*x01 其中x1,x2是未知数,其余是已知数,我是这么考虑的syms x1 x2;
x01=27;
x02=44.01;
x03=17.16;
x04=25.65;
x05=6;
f1=sym('sin(x1)*(sqrt(x01^2+x02^2-2*x01*x02*cos(x2)))=sin(x2)*x01');
f2=sym('x03^2=(x02*sin(x2)-x04*sin(x1+x2)-x05)^2+(x02*cos(x2)-x04*cos(x1+x2))^2');
[X,Y]=solve(f1,f2,'x1,x2')
syms x1 x2;
x01=27;
x02=44.01;
x03=17.16;
x04=25.65;
x05=6;
f1 = sin(x1)*(sqrt(x01^2+x02^2-2*x01*x02*cos(x2))) - sin(x2)*x01 ;
f2 = (x02*sin(x2)-x04*sin(x1+x2)-x05)^2+(x02*cos(x2)-x04*cos(x1+x2))^2 - x03^2 ;
s = solve(f1,f2);
X = s.x1 % x1的值
Y = s.x2 % x2的值
再问: 提示有错误的呀???? Error using ==> reshape To RESHAPE the number of elements must not change. Error in ==> sym.maple at 94 result = reshape(result,size(varargin{3})); Error in ==> sym.sqrt at 7 Y = maple('map','sqrt',X);
再答: http://hiphotos.baidu.com/zzz700/pic/item/a59474c77d1ed21ba80b27afad6eddc450da3fbb.jpg 上图是以maple作符号运算的版本(如5.3版、7.1版)求的结果, 下图是以maple作符号运算的版本(如2010a版、2011b版)求的结果: http://hiphotos.baidu.com/zzz700/pic/item/838b57d3277f9e2fee3915421f30e924b899f376.jpg 提示:solve不一定能求出所有的解,并且有可能出错。