求助:非线性方程的解谢谢
非线性方程求解ms = 5; ns = 20 ; n2 =100; alfarad = 20;
y2min = -300; y2max = -240; zpeak = -46.9846; angle0 = 90;
angle=angle0*pi/180;
alfa = alfarad * pi / 180; %将压力角转化为弧度制
rbs = 0.5 * ms * ns * cos(alfa);%计算小齿轮基圆半径
ras = 0.5 * ms * ns + ms; %计算小齿轮齿顶圆半径
q2s = ns /n2; %计算传动比
thetas0 = pi/(2*ns) - (tan(alfa) - alfa);%计算刀具齿槽对称线到渐开线起始点的角度参数:
y2 = linspace(y2min,y2max,10);
options = optimset('Display','off'); %fzeor函数显示设置:
y2=linspace(150,250,10);
syms eus us phistrans;
phi2trans = q2s * phistrans;
zmin = zpeak;
thetastrans = ((ras)^2 - (rbs)^2)^0.5 / rbs;
phithetatrans = phistrans + (thetas0 + thetastrans);
phistransmax = PhisTransMax(zmin,rbs,thetastrans,thetas0,angle,q2s);
phistranslimits(:,2) = phistransmax * ones(1,10);
Z2dot(1:10)=zpeak + 1/(1:10);
for k = 1:10
phistranslimits(k,1) = PhisTransMax(z2dot(k,10),rbs,thetastrans,thetas0,angle,q2s);
end
AA = sin(phithetatrans) - thetastrans * cos(phithetatrans);
BB = cos(phithetatrans) + thetastrans * sin(phithetatrans);
for k = 1:10
yf2trans = @(phistrans,eus)(subs(y2(k) + rbs * (AA * sin(phi2trans) + BB * cos(angle) * cos(phi2trans)) + eus * sin(angle) * cos(phi2trans)));
phistransnum(k,:) = linspace(phistranslimits(k,1),phistranslimits(k,2),10);
for m = 1:10
usnum(k,m) = fzero(yf2trans,0,options,phistransnum(k,m));
end
end
usnum
%子函数
function Key = PhisTransMax(z2star,rbs,thetastrans,thetas0,angle,q2s)
syms phithetatrans0;
Bb = cos(phithetatrans0) + thetastrans*sin(phithetatrans0);
us0 = rbs / (q2s * cos(phithetatrans0));
z2f=@(phithetatrans0)(subs(z2star + rbs * Bb * sin(angle) - us0 * cos(angle)));
options = optimset('Display','off');
z = fzero (z2f,0.5,options);
Key = z - (thetas0 + thetastrans);
求USNUM的值,不知道怎么的,老是出错,请各位大虾指点,谢谢了
回复 楼主 xgxpizza 的帖子
非线性方程的求解,我帮你看看吧为什么我是学机械的
只知道是齿轮,而不知道是什么模型啊 LZ未给出报错讯息
回复 楼主 xgxpizza 的帖子
我帮你看了一下是很多数组的维数不对
实际上解决这种问题的方法很简单
就是注释比代码写的多,自己也能看出来
楼组应该很有编程经验的啊
但是我们看不动模型,就很难下手改
你自己多检查一下吧,帮不上忙不好意思 谢谢各位了,上面是面齿轮的y坐标的方程
我想问下,符号函数不知道我用对没?有大虾解释下符号函数到底该怎么用?是否每次运行前都要清空其值?
谢谢各位了
{phistrans}
??? Error using ==> maple
Error, integer too large in context
Error in ==> sym.findsym at 33
v = maple('indets', sc ,'symbol');
Error in ==> sym.subs at 65
vars = findsym(OLDf);
Error in ==> @(phistrans,eus)(subs(y2(k)-rbs*(thetastrans*sin(phi2trans)*cos(phithetatrans)-cos(angle)*cos(phi2trans)*cos(phithetatrans)-sin(phi2trans)*sin(phithetatrans)- thetastrans*cos(angle)*cos(phi2trans)*sin(phithetatrans))+eus*sin(angle)*cos(phi2trans)))
Error in ==> fzero at 379
b = x + dx;fb = FunFcn(b,varargin{:});
Error in ==> Untitled at 34
usnum(k,m) = fzero(yf2trans,0.1,options,phistransnum(k,m));
这是它的报错信息,请大家多多指教,谢谢
[ 本帖最后由 ChaChing 于 2010-1-14 11:20 编辑 ]
页:
[1]