Clear Filters
Clear Filters

how Can I find the minimum value of my functions by fzero?

2 views (last 30 days)
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;

Answers (1)

Alan Weiss
Alan Weiss on 1 Apr 2015
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

Categories

Find more on Optimization in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!