Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Fsolve problem in solving transcndental equation.

Subject: Fsolve problem in solving transcndental equation.

From: David Garrido Lopez

Date: 16 Sep, 2010 21:50:22

Message: 1 of 2

Hi,

I am trying to solve a transcendental equation with fsolve and should be easy but I always end up with the same result, and I get the following warning:
"Optimizer appears to be converging to a minimum that is not a root:
Sum of squares of the function values is > sqrt(options.TolFun).
Try again with a new starting point."

My code is the following:

function no(T)
format long;
%%%%%%% Definition of variables
Nd = 1e17;
Na = 5e16;
K = 8.617343e-5;
Eg = 1.166 - ((T*0.473e-3)^2)/(T + 636);
Nc = 2.8e19*(T/300)^(3/2);
Nv = 1.04e19*(T/300)^(3/2);
ni = sqrt(Nc*Nv)*exp(-Eg/(K*T));
mo = 9.11e-31;
me = 1.08*mo;
mh = 0.81*mo;
Ea = 45e-3;
Ed = Eg - 44e-3;
h = 6.626e-34;

f=@(n) (Nd*0.5*exp(-44e-3/(K*T))*Nc)/(n + 0.5*exp(-44e-3/(K*T))*Nc) - Na*n/(n + 4*exp((45e-3-Eg)/(K*T))*Nc) + (ni^2)/n -n;
sol=fsolve(f, Nd-Na)


The last two lines are the main code. Where f is my function and sol should be the solution. I know that the exact solution (or very close) at T=300 is Nd-Na, so that's why I use that as the initial guess. But then independing of T, the result is always the same (Nd-Na) which is wrong.
I would really appreciate any help that helps me figure out what is going on and how can I solve that equation.

Thanks,

David.

Subject: Fsolve problem in solving transcndental equation.

From: Roger Stafford

Date: 16 Sep, 2010 22:44:04

Message: 2 of 2

"David Garrido Lopez" <forolo86@hotmail.com> wrote in message <i6u3eu$8vs$1@fred.mathworks.com>...
> Hi,
>
> I am trying to solve a transcendental equation with fsolve and should be easy but I always end up with the same result, and I get the following warning:
> "Optimizer appears to be converging to a minimum that is not a root:
> Sum of squares of the function values is > sqrt(options.TolFun).
> Try again with a new starting point."
>
> My code is the following:
>
> function no(T)
> format long;
> %%%%%%% Definition of variables
> Nd = 1e17;
> Na = 5e16;
> K = 8.617343e-5;
> Eg = 1.166 - ((T*0.473e-3)^2)/(T + 636);
> Nc = 2.8e19*(T/300)^(3/2);
> Nv = 1.04e19*(T/300)^(3/2);
> ni = sqrt(Nc*Nv)*exp(-Eg/(K*T));
> mo = 9.11e-31;
> me = 1.08*mo;
> mh = 0.81*mo;
> Ea = 45e-3;
> Ed = Eg - 44e-3;
> h = 6.626e-34;
>
> f=@(n) (Nd*0.5*exp(-44e-3/(K*T))*Nc)/(n + 0.5*exp(-44e-3/(K*T))*Nc) - Na*n/(n + 4*exp((45e-3-Eg)/(K*T))*Nc) + (ni^2)/n -n;
> sol=fsolve(f, Nd-Na)
>
>
> The last two lines are the main code. Where f is my function and sol should be the solution. I know that the exact solution (or very close) at T=300 is Nd-Na, so that's why I use that as the initial guess. But then independing of T, the result is always the same (Nd-Na) which is wrong.
> I would really appreciate any help that helps me figure out what is going on and how can I solve that equation.
>
> Thanks,
>
> David.
- - - - - - - -
  Unless my eyes deceive me, that is not a transcendental equation in the unknown n. It can be reduced to a quartic polynomial equation in n which you can solve with matlab's 'roots' function, once you know the value of T and the various other variables. That suggests that you may have used an unwise initial estimate in fsolve which gets caught in a local minimum above zero, but why use fsolve at all in such a simple problem?

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us