how Can I find the minimum value of my functions by fzero?
3 次查看(过去 30 天)
显示 更早的评论
Hi everyone, I want to minimize my function in which only Hw and Jw is changed so it would be useful to do it by fzero, this function is a function of other constant parameters and formulation as follows, my goal is to find one value of Hw for each equivalent Jw based on my function meaning for each Jw there must be one Hw which is unknown and I want to calculate it.my function is:
function= tau_i*si*((1/(1-Hw))+(1/Hw))-((tau_w*sw)/Hw)
D=0.040; A=pi*D^2/4; Jo=[0.74]; Jw=[0.35 0.25 0.19 0.12 0.08]; ro_o=910; ro_w=1000; mu_w=0.001; mu_o=0.92; nu_w=mu_w./ro_w; nu_o=mu_o/ro_o;
Aw=Hw*A;
Do=D-(2*sqrt(Aw./pi));
si=pi.*Do;
Uo=(Jo./(1-Hw));
Uw=Jw./Hw;
fi=16*(Do.*Uo/nu_o).^-1.0;
tau_i=0.5*ro_o*16*(((Do.*Uo)./nu_o).^-1.0).*(Uo).*(Uo);
sw=pi*D;
Dw=Hw.*A;
Rew=(Dw.*Uw./nu_w);
fw=0.046.*(Rew).^-0.2;
taw_w=(fw.*ro_w.*(Jw./Hw).^2)./2;
0 个评论
回答(1 个)
Alan Weiss
2015-4-1
fzero is not a minimizer. It finds a point where the function changes sign. So it is usually used to find a point where a function is zero, or nearly so.
You might want to use fminbnd, which is a minimizer. For each value of Jw you can write a function of Hw alone, and pass that to fminbnd. You need to give fminbnd a lower and upper bound in the range where the minimum might be, and sometimes it is hard to figure that out, but do a little experimentation and I am sure that you will succeed.
Alan Weiss
MATLAB mathematical toolbox documentation
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!