Info

This question is closed. Reopen it to edit or answer.

failure in initial user-supplied objective function evaluation

3 views (last 30 days)
c=3.8;
ncl=3;
nc=3;
syms u w n
Jn=besselj(n,u);
Jnp=diff(Jn,u);
Kn=besselk(n,w);
Knp=diff(Kn,w);
J0=Jnp/(u*Jn);
K0=Knp/(w*Kn);
CH=(J0+K0)*(J0+(ncl/nc)^2*K0)-n^2*(1/u^2+1/w^2)*(1/u^2+(ncl/nc)^2*1/w^2);
CHL=limit(CH,w,0); x0=(3);
for m=0:9
CHA=subs(CHL,n,m);
options = optimoptions('fsolve','Display','iter'); % Option to display output
fval= fsolve(matlabFunction(CHA),x0,options) % Call solver

Answers (1)

Walter Roberson
Walter Roberson on 27 May 2015
I already told you the reason for that Previous Discussion.
Your CH has two 1/w^2 terms. As w approaches 0, those approaches infinity. You do not have any other use of w that might go to 0 "faster" to "cancel out" that infinity. Your CHL is therefore going to be infinity unless it happens to invoke some other behaviour like accidentally getting a 0/0 or a 0 * infinity.
You are not going to be able to get any further on your optimization until you change CH so it does not have 1/w, or until you change the limit so that you are not going to w=0. Remember, just because you take a limit() instead of directly evaluating a function doesn't mean that you won't get a division by 0. limit(1/w^2,w,0) is infinity no matter what you do.
  1 Comment
nima salyani
nima salyani on 27 May 2015
Edited: nima salyani on 27 May 2015
very thank to you.as I understood you mean that 1/w^2 goes faster than Knp/(w*Kn) to infinity but as I know small argument of besselK(n,x) is proportional to 0.5*gamma(n)*(2/x)^n when 0<|x|<sqrt(1+n) and it's derivitave is proportional to besselK(n-1,x)-besselK(n+1,x).so it's appearant that K0 is as fast as 1/w^2 when(w-->>0).also I checked the equation for last time from book and it must have solution. I sincerely need your help.

Community Treasure Hunt

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

Start Hunting!