1
$\begingroup$

I have the following code:

q = 1.6*10^-19;
hbar := 6.63/(2*\[Pi])*10^-34;
m0 = 9.1*10^-31;
kb = 1.38*10^-23;
Cap := 4.5*10^-3;
W := 50*10^-6;
mu := 4.3*10^-4;
n := 20;
vth = ((3*kb*300)/m0)^0.5;
vt := -3.5;
Rex := 15 ;
vg = 0;
Plot[id /. 
  FindRoot[(id - (Cap*W*mu*(n*vth)^2)/(
      7*10^-6)*(PolyLog[2, -Exp[(vd - id - vg + vt)/(n*vth)]] - 
        PolyLog[2, Exp[(id - vg + vt)/(n*vth)]])), {id, 
    10^-6}], {vd, -1, .872}, ImageSize -> Large, 
 AxesLabel -> {vd, id}, LabelStyle -> {15, Bold, Black}]

It shows this error:

enter image description here

How can I specify the correct AccuracyGoal and PrecisionGoal for my problem. Also I want to plot the $id$ as a function of $vd$ for different $vg$, is there a way to automate it?

$\endgroup$
1
  • $\begingroup$ For your first question, you can look them up in the docs for FindRoot. $\endgroup$
    – Michael E2
    Commented Mar 1, 2021 at 1:05

1 Answer 1

2
$\begingroup$

Maybe with some or all of these changes [update: changed starting points to complex numbers ±10^6(1±I)]:

ReImPlot[                        (* solution is complex-valued *)
 id /. FindRoot[(id - (Cap*W*mu*(n*vth)^2)/(7*10^-6)*(PolyLog[
         2, -Exp[(vd - id - vg + vt)/(n*vth)]] - 
        PolyLog[2, Exp[(id - vg + vt)/(n*vth)]])),
   {id, Sign[vd] 10^6 + 10^6 I}  (* better starting point *)
   ],
 {vd, -10^8, 10^8},              (* larger plot domain *)
 ImageSize -> Large, AxesLabel -> {vd, id}, 
 LabelStyle -> {15, Bold, Black}]

enter image description here

Changing the starting point to Sign[vd] 10^6 - 10^6 I gives conjugate solutions.

$\endgroup$
4
  • $\begingroup$ If I just want the solution from {vd,-10,0}, how do I decide what estimate of id I should give? Is there some way to estimate that or automate that? When I try plotting the solution for {vd,-10,0} I get the same error I showed in my original question. $\endgroup$ Commented Mar 1, 2021 at 3:21
  • $\begingroup$ Thanks, it clears a lot of confusion. Do you have any recommendations on how to solve it for different vg as in for vg={0,1,2,3,4,5,6} and plot id-vd? $\endgroup$ Commented Mar 1, 2021 at 3:48
  • $\begingroup$ @Indeterminate From PolyLog[2, Exp[(id - vg + vt)/(n*vth)]], it follows that no real solution exists for id - vg + vt > 0. $\endgroup$
    – bbgodfrey
    Commented Mar 1, 2021 at 4:49
  • $\begingroup$ @Indeterminate Turns out FindRoot wasn't looking for complex solutions for small negative vd. Add an imaginary part to the starting point to force that. Then there are conjugate solutions for vd above around -1.4 * 10^7 judging from the graph. $\endgroup$
    – Michael E2
    Commented Mar 1, 2021 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.