这个是我自己写的函数代码
cd=0.625;
ps=70e5;
kk=2e-12;
d=870;
xs=0.000004;
op1=(0.0000045+xs); %valve open area
op2=(0.0000045-xs);
if op1<0 % simulate the actual valve open area
Av1=0;
else
Av1=7.938e-3*pi*op1;
end
if op2<0;
Av2=0;
else
Av2=7.938e-3*pi*op2;
end
r=11.43/5.8;
p1fnc=@(p1)(cd*(2/d)^0.5*(Av1*(ps-p1)^0.5-Av2*(p1)^0.5)+kk*(p1-p1*r)*(r-1)-r*cd*(2/d)^0.5*(Av1*(p1*r)^0.5-Av2*(ps-r*p1)^0.5));
options=optimset;
options = optimset(options,'TolX',1e-16);
options = optimset(options,'TolFun',1e-20);
options = optimset(options,'MaxFunEvals',Inf);
y=fsolve(p1fnc,1e5,options);
运行结果总是:
Equation solved, fsolve stalled.
fsolve stopped because the relative size of the current step is less than the
selected value of the step size tolerance squared and the vector of function values
is near zero as measured by the selected value of the function tolerance.
自己画了一个p1fnc的图像,p1从1e5到1e6。图像如下,解是图中的红色点。已经减小了function tolerance可是还是不行啊。应该怎么设置呢。
1.png
(11.75 KB, 下载次数: 0)
2013-11-17 19:45 上传
p1fnc vs p1