From: tang cheng on
hello when I use solve command ,I find some error
I hope someone can help me to debug it
this problem as follow:
as=pi/9;%压力角
m=0.75;%模数
bb=pi*35/180;%螺旋角
ns=9;%齿杆齿数
rbs=m*ns*cos(as)/2;%基圆半径
rbottom=m*ns/2+1.25*m;%齿盘的齿底圆
rtop=m*ns/2-1*m;%齿盘的齿顶圆
tt0=pi/(2*ns)-tan(as)+as;%初始角度
s=2*pi*rbs/tan(bb);%导程
q2s=41/9;%齿数比
ps=s/2*pi;%螺旋参数
E=8;%偏置距离
z=linspace(rtop,rbottom,5);%取20等份
y=linspace(13.5,17.5,5);%取20等份
%syms zz yy;
[zz,yy]=meshgrid(z,y);%转换变量为矩阵
syms ww tt ww2;
E1=rbs-ps*(ww2-ww-tt-tt0)*q2s*cos(ww2);
E2=-yy-rbs*(sin(q2s*ww)*(sin(ww2)-tt*cos(ww2))+cos(q2s*ww)/(q2s*cos(ww2))+E/rbs*sin(q2s*ww));
E3=-zz-rbs*(cos(ww2)+tt*sin(ww2));
[ww tt ww2]=solve(E1,E2,E3)


I hope know the value of ww and tt and ww2
but here has a error ,besides i hope know how can I use "fsolve" and I want to know how can solve this problem.
thanks
tangcheng
From: Steven_Lord on


"tang cheng" <tangch8(a)qq.com> wrote in message
news:i3gjhf$l6l$1(a)fred.mathworks.com...
> hello when I use solve command ,I find some error I hope someone can help
> me to debug it
> this problem as follow:

*snip*

> [ww tt ww2]=solve(E1,E2,E3)

Don't do this. You're making an assumption about the order in which SOLVE
returns the values it computed from your equations. Instead call SOLVE with
one output argument:

solutions = solve(E1, E2, E3);

and index into the solutions struct to obtain the solutions for each
variable.

ww = solutions.ww;

> I hope know the value of ww and tt and ww2
> but here has a error

If you ask for help with an error, you should include the text of the error
message in your post!

> ,besides i hope know how can I use "fsolve" and I want to know how can
> solve this problem.

FSOLVE and SOLVE are two completely different functions. Do you want to
solve this problem numerically (in which case FSOLVE from Optimization
Toolbox is the right tool) or symbolically (in which case using SOLVE is
appropriate?)

Please respond IN THE NEWSGROUP rather than to me directly, as that way
others may be able to answer your question before I get a chance to do so.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com