You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
eqn solver could not solve my specific seqn
4 views (last 30 days)
Show older comments
Hi all,
Hope you are good.
I have a question about eqn solver. I have an array of constants for a variable and for this I created a for loop which works well but since my eqn is non-linear It does not solve it. Here is my code;
syms Vs Vg p k d Vfb
load b1mhz.txt
Vg = b1mhz(:,1);
prompt = 'k(dielectric constant) :';
k = input(prompt)
prompt = 'p(doping const.) :';
p = input(prompt)
prompt = 'd(thickness in cm) :';
d = input(prompt)
prompt = 'Vfb(V) :';
Vfb = input(prompt)
for i = 1:length(Vg)
Sol{i} = vpa(solve(Vg - Vfb - Vs - (11.7/k)*((2*0.026*p*1.6*10^-19)/(11.7*8.85*10^-14))^0.5*(d*11.7/k)*(exp(-Vs/0.026)+(Vs/0.026)-1+(1.5*10^10/p)^2*(exp(Vs/0.026)-(Vs/0.026)-1))^0.5 == 0,Vs));
end
Vg is my variable and I am stuck right now. I appreciate any help.
Best Regards,
Hasan
3 Comments
Answers (4)
Walter Roberson
on 8 Feb 2021
guess = 1;
for i = 1:length(Vg)
Sol{i} = vpasolve(Vg - Vfb - Vs - (11.7/k)*((2*0.026*p*1.6*10^-19)/(11.7*8.85*10^-14))^0.5*(d*11.7/k)*(exp(-Vs/0.026)+(Vs/0.026)-1+(1.5*10^10/p)^2*(exp(Vs/0.026)-(Vs/0.026)-1))^0.5 == 0,Vs, guess);
%make it easier for the next iteration by starting at the solution for this iteration
if ~isempty(Sol{i}); guess = Sol{i}; end
end
4 Comments
Hasan canar
on 8 Feb 2021
Thank you for quick reply. I got an error with your code
Error using sym.getEqnsVars>checkVariables (line 88)
The second argument must be a vector of symbolic variables.
Error in sym.getEqnsVars (line 60)
checkVariables(vars);
Error in solve>getEqns (line 460)
[eqns, vars] = sym.getEqnsVars(argv{:});
Error in solve (line 227)
[eqns,vars,options] = getEqns(varargin{:});
Error in Vsurface (line 28)
Sol{i} = vpa(solve(Vg - Vfb - Vs -
(11.7/k)*((2*0.026*p*1.6*10^-19)/(11.7*8.85*10^-14))^0.5*(d*11.7/k)*(exp(-Vs/0.026)+(Vs/0.026)-1+(1.5*10^10/p)^2*(exp(Vs/0.026)-(Vs/0.026)-1))^0.5
== 0,Vs, guess));
Walter Roberson
on 8 Feb 2021
syms Vs
guess = 1;
for i = 1:length(Vg)
Sol{i} = vpasolve(Vg(i) - Vfb - Vs - (11.7/k)*((2*0.026*p*1.6*10^-19)/(11.7*8.85*10^-14))^0.5*(d*11.7/k)*(exp(-Vs/0.026)+(Vs/0.026)-1+(1.5*10^10/p)^2*(exp(Vs/0.026)-(Vs/0.026)-1))^0.5 == 0, Vs, guess);
%make it easier for the next iteration by starting at the solution for this iteration
if ~isempty(Sol{i}); guess = Sol{i}; end
end
Notice that I used vpasolve() whereas you used vpa(solve()) which will not work for this situation.
Also I did not notice before that your Vg was a vector, which is something that would have caused your solve() to fail.
Hasan canar
on 8 Feb 2021
In function context, vpa() shown like this so this is why I tried to take solve into it. Thank you Mrs. Roberson.
Walter Roberson
on 10 Feb 2021
syms Vs
guess = 1;
for i = 1:length(Vg)
thissol = vpasolve(Vg(i) - Vfb - Vs - (11.7/k)*((2*0.026*p*1.6*10^-19)/(11.7*8.85*10^-14))^0.5*(d*11.7/k)*(exp(-Vs/0.026)+(Vs/0.026)-1+(1.5*10^10/p)^2*(exp(Vs/0.026)-(Vs/0.026)-1))^0.5 == 0, Vs, guess);
%make it easier for the next iteration by starting at the solution for this iteration
if isempty(thissol)
Sol(i) = nan;
else
Sol(i) = thissol;
guess = thissol;
end
end
Hasan canar
on 9 Feb 2021
Dear Walter Roberson,
For the code, I got answers for array with constants as follows ;
ans =
[ (1.0*(0.000000000000000000000010298793683305838725170175386148*exp(38.461538461538461538461538461538*Vs) - 0.00000000011882073008656817778569365181478*exp(-0.0000000000000000061538461538461544345633745197684*Vs) + 0.00000000011882073008655787899201034597605))/(38.461538461535127882380909026407*Vs + 0.000000000000086675058096365313412051053389771*exp(38.461538461538461538461538461538*Vs) + exp(-38.461538461538461538461538461538*Vs) - 1.0000000000000866750580963653134)^(1/2), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.0011804714531640685265521666897429, -0.003107975792678391121372776300572, -0.0049872197067388673171578377757343, -0.0068200592905810590709409179810468, -0.0086082688150957658293523389080111, -0.010353543876480569195094603235466, -0.012057504550050829744839135049255, -0.013721698523298945873184180032984, -0.015347604187689630643454842625559, -0.016936633672553770848605699467851, -0.018490135807828325474069623922916, -0.020009399005323344831645815270283, -0.021495654050720214172369777429311, -0.022950076800658551798103898892806, -0.02437379078109268603052401455184, -0.025767869684630245655516524107357, -0.027133339765840594725783908886838, -0.028471182134572297200661929087231, -0.029782334948176244532720200951695, -0.031067695504221308258049589158733, -0.032328122235836315069357575369644, -0.033564436612236990792325430145452, -0.034777424947317954548224874659596, -0.035967840119424207414579575531249, -0.037136403205578075879461501773042, -0.038283805033538558443495960028402, -0.039410707655121101900684484010274, -0.040517745744216112390485342543022, -0.041605527922921767284222403786272, -0.042674638019157555652558932068209, -0.043725636259055041153273319197735, -0.044759060397336334694986544781996, -0.045775426788792646877090138859264, -0.046775231403868368072690560633967, -0.047758950791243140659558934433853, -0.048727042990187605854896121120603, -0.049679948395349779524161928743738, -0.050618090576509841760051246052651, -0.051541877055722723896217405596355, -0.052451700044151205394886654850354, -0.053347937140778044418164740225555, -0.05423095199507453782081503305548, -0.055101094935595271137284365481555, -0.055958703566364988452359209425451, -0.056804103332823697771243302179999, -0.057637608059000459849720438953707, -0.0584595204574948510668142802948, -0.05927013261375785372934772690809, -0.060069726446080877118031356548496, -0.060858574142622682598963340006182, -0.061636938576729082817600352882953, -0.062405073701729294842779838618145, -0.063163224926325621725239399561914, -0.063911629471629577285563256570078, -0.064650516710837509014323644678189, -0.065380108492482063561050598424622, -0.06610061944814232640336011708639, -0.06681225728544499998535163144822, -0.067515223067141412520892016755855, -0.068209711477000325135580791463906, -0.06889591107321428407699866243612, -0.069574004529977507688375771659269, -0.070244168867855869873465801901717, -0.07090657567353431321066955962639, -0.071561391309493871429890672541197, -0.072208777114139283894183132645769, -0.07284888959286883084037163879711, -0.073481880600550399778469882556585, -0.074107897515841808444232644609546, -0.074727083407768961209065731592372, -0.07533957719495241224969446906181, -0.075945513797851263478225272715745, -0.076545024284372956498255895019041, -0.07713823600917834861120659779956, -0.0777252727469934205339654267053, -0.078306254820221979642279055201705, -0.078881299221137732909571376082203, -0.079450519728919047797082859335918, -0.080014027021775540340501487143002, -0.080571928784402274190055026452456, -0.081124329810984772272243791988221, -0.081671332103966187002970842298756, -0.082213034968776801442502607556593, -0.082749535104715501020083665549816, -0.083280926692162924615357513564116, -0.083807301476296638424239517813572, -0.084328748847469841985842490598761, -0.084845355918406780961450459827994, -0.085357207598360175692071289396797, -0.085864386664368550048431726218593, -0.086366973829744335215242890665346, -0.086865047809917003057106721364552, -0.087358685385749230377997412367855, -0.087847961464438186938322873268464, -0.088332949138108456117101688467379, -0.088813719740197818455206461243692, -0.08929034289973213703113071838778, -0.089762886593580862858643706704452, -0.090231417196780212453484564642533, -0.090695999531006843567102159681895, -0.091156696911280854916021438331438, -0.091613571190973148487552711877076, -0.09206668280518860641874382543881, -0.092516090812593137017801193884293, -0.092961852935749425419628647515881, -0.093404025600023173490805295281283, -0.093842663971118721390826039303006, -0.094277821991300200698710221176275, -0.094709552414351767809939494333471, -0.095137906839327998486605538839987, -0.095562935743143182565889171850107, -0.095984688512046034904728079304627, -0.096403213472024228083940039346328, -0.096818557918181148025242155891415, -0.097230768143125369667145795239376, -0.097639889464411540720909716149206, -0.098045966251069642127260097543143, -0.098449041949257959301504821546214, -0.098849159107073544014797350303836, -0.099246359398552468503751963617158, -0.099640683646890767069448690210467, -0.10003217184691562219384900796327, -0.10042086318683507845991633184217, -0.10080679606929335491045097153747, -0.10119000813175767171244537097759, -0.10157053626626140708304136360988, -0.10194841663852735252511093684623, -0.10232368470649383582077501834793, -0.10269637523826552939638805900676, -0.10306652232950985420107506164222, -0.10343415942031902386464539959662, -0.10379931931155694847694609706939, -0.10416203418070942983484387676641, -0.10452233559725532852153504144929, -0.10488025453757566590685213599799, -0.10523582139941693937620600452592, -0.10558906601592427519203329241227, -0.10594001766925941883471110773557, -0.10628870510381796601173316409622, -0.10663515653905966739393420427817, -0.10697939968196509523820517251416, -0.10732146173913143915886593538522, -0.10766136942851970025103491150249, -0.10799914899086507644661929151853, -0.10833482620076187635242577337463, -0.10866842637743386289039797182179, -0.10899997439520051089365554818742, -0.10932949469364926351898864472972, -0.10965701128752349007280200242163, -0.10998254777633548181261642408869, -0.11030612735371347172049158368105, -0.11062777281649132842720846334786, -0.11094750657354925271239759627336, -0.11126535065441349666625799644383]
For the rest of the solutions you may scroll to far right !!! >>>>>>>
As we can see first term was not solved and kept in exp form. For the following (i) solutions I got many Zeros and few answers.
Isn^t this code good enough to solve such a non-linear eqn ? To be honest I don't expect too many Zeros as solution. It is somehow not-logical -for the system I am working on.
I appreciate any further help!
Best,
Hasan
3 Comments
Walter Roberson
on 9 Feb 2021
The code I posted cannot return the answers you show.
- my code returns a cell array, your code has a regular array
- my code returns empty cells when a solution cannot be found, rather than leaving an unresolved solution
To get the output you show, you would need to be using different code using solve() instead of vpasolve, and also having a couple of other bugs.
Hasan canar
on 10 Feb 2021
Edited: Hasan canar
on 10 Feb 2021
@Walter Roberson Sir ;
With your code, I don't see any result of course with vpasolve(). I use ''vpa'' because I got not-divided answers(rational) answers.
I use subs() command for revealing the results, otherwise; ı don't get any result.
To be honest, your code works perfectly but I have to find out a way to solve unsolved parts of the answers.
Walter Roberson
on 10 Feb 2021
It is possible for vpasolve() to be unable to find a solution from a given starting point. However, in such cases, solve() usually cannot do any better. With the expression you are trying to work with, I can nearly guarantee that solve() cannot do any better than vpasolve(), and solve() is more likely to give up.
The general solution has at least two nested nonlinear roots -- that is, the solution requires finding the roots of one nonlinear equation, and the values found become part of the coefficients of another nonlinear equation that has to be solved. There is a third level too that is a quadratic equation that you have to find a specific root of, which you can do when you know specific numeric values for the input() prompts
Hasan canar
on 11 Feb 2021
@Walter Roberson Sir,
I suppose your code does only one iteration but can we increase the iteration number to enhance the chance of finding results for zero answers ?
22 Comments
Walter Roberson
on 11 Feb 2021
We could do better if there were constraints on the range of answers. For example is it known that the solution must be real-valued? Is it always going to be positive? Is it bigger than a bread box?
syms Vs
guess = 1;
maxtries = 10;
for i = 1:length(Vg)
%try once using the last value that worked
thissol = vpasolve(Vg(i) - Vfb - Vs - (11.7/k)*((2*0.026*p*1.6*10^-19)/(11.7*8.85*10^-14))^0.5*(d*11.7/k)*(exp(-Vs/0.026)+(Vs/0.026)-1+(1.5*10^10/p)^2*(exp(Vs/0.026)-(Vs/0.026)-1))^0.5 == 0, Vs, guess);
if isempty(thissol)
%if that did not work, try using random starting points
for trynum = 1 : maxtries - 1
thissol = vpasolve(Vg(i) - Vfb - Vs - (11.7/k)*((2*0.026*p*1.6*10^-19)/(11.7*8.85*10^-14))^0.5*(d*11.7/k)*(exp(-Vs/0.026)+(Vs/0.026)-1+(1.5*10^10/p)^2*(exp(Vs/0.026)-(Vs/0.026)-1))^0.5 == 0, Vs, 'random');
if ~isempty(thissol); break; end
end
end
if isempty(thissol)
Sol(i) = nan;
else
Sol(i) = thissol;
%make it easier for the next iteration by starting at the solution for this iteration
guess = thissol;
end
end
Hasan canar
on 11 Feb 2021
@Walter Roberson. Solution can be both negative and positive. Definitely real values are expected. For the code; I got an error like that
Error using sym/vpasolve (line 97)
Option 'random' requires one of the values true or false.
Error in Vsurface (line 26)
thissol = vpasolve(Vg(i) - Vfb - Vs -
(11.7/k)*((2*0.026*p*1.6*10^-19)/(11.7*8.85*10^-14))^0.5*(d*11.7/k)*(exp(-Vs/0.026)+(Vs/0.026)-1+(1.5*10^10/p)^2*(exp(Vs/0.026)-(Vs/0.026)-1))^0.5
== 0, Vs, 'random');
Walter Roberson
on 11 Feb 2021
thissol = vpasolve(Vg(i) - Vfb - Vs - (11.7/k)*((2*0.026*p*1.6*10^-19)/(11.7*8.85*10^-14))^0.5*(d*11.7/k)*(exp(-Vs/0.026)+(Vs/0.026)-1+(1.5*10^10/p)^2*(exp(Vs/0.026)-(Vs/0.026)-1))^0.5 == 0, Vs, 'random', true);
Hasan canar
on 12 Feb 2021
Edited: Hasan canar
on 12 Feb 2021
@Walter Roberson Thank you so much.
I guess there is a limitation about decimals.
This data is belongs to let's say results for #1 ;
0
0
0
0
0
-3,85856E-4
-0,00771
-0,01435
-0,02042
-0,02598
-0,03111
-0,03586
-0,04028
-0,0444
-0,04826
and this one (below) belongs to #2 ;
0
0
0
-0,05285
0,00266
0,03351
0,07841
0,11122
0,16445
As you can see below for #1; code found as answers as low as -E-4,
for #2 it could not afford to find less than -E-2
So, there are 59 zeros out of 126 answers.
Walter Roberson
on 12 Feb 2021
Notice that they are 0 and not nan, which is the value my code fills in when nothing is found. That implies that vpasolve thought 0 was close enough to a solution.
You might want to adjust the vpasolve options that deal with tolerance.
Hasan canar
on 12 Feb 2021
Edited: Hasan canar
on 12 Feb 2021
@Walter Roberson You are right. Maybe I should find another way to solve this issue.
Thank you for your assistance and time. If I could manage to modify your code, I am pleased to nominate your name in my publication.
Sincerely,
Hasan
Walter Roberson
on 12 Feb 2021
Hmmm, there are no controls for precision for vpasolve... I thought there were.
You could try increasing digits()
Hasan canar
on 12 Feb 2021
@Walter Roberson I think I should add tolerance value for fixing the issue
Walter Roberson
on 13 Feb 2021
I would need your input file and your response to the input() questions to test more.
Walter Roberson
on 19 Feb 2021
My tests with Vg = -15 and those constants suggest that there is no zero for that function, including there not being any complex value that leads to a zero of the function.
Hasan canar
on 19 Feb 2021
If you set Vg = -6.14, you will definitely get Vs = 0. Try it by writing it down on a paper.
Walter Roberson
on 19 Feb 2021
Perhaps, but the first Vg in Vg.txt is -15, and for Vg == -15, and the constants from your other const.txt my tests show there is no solution for Vs, including no complex solution.
Hasan canar
on 19 Feb 2021
Edited: Hasan canar
on 19 Feb 2021
It is my mistake Sir. Could you try Vg = -6.14 now ?
Since I took take by 0.2 increments. It does not contain -6.14 but If you connect datas by a line one can easily see that Vg = -6.14 crosses Vs = 0
Walter Roberson
on 19 Feb 2021
Q = @(v) sym(v);
syms Vs Vg p k d Vfb
load b1mhz.txt
Vg = b1mhz(:,1);
%{
prompt = 'k(dielectric constant) :';
k = Q(input(prompt));
prompt = 'p(doping const.) :';
p = Q(input(prompt));
prompt = 'd(thickness in cm) :';
d = Q(input(prompt));
prompt = 'Vfb(V) :';
Vfb = Q(input(prompt));
%}
d = 95e-7;
p = 5.095e16;
k = 3.73;
Vfb = -6.14;
numVg = length(Vg);
Sol = zeros(numVg,2,'sym');
wb = waitbar(0,'Please wait');
%onCleanup(@() delete(wb));
for i = 1:numVg
waitbar(i/numVg, wb);
Vgi = sym(sprintf('%g',Vg(i))); %we were seeing some odd floating point conversions
Sol(i,1) = Vgi;
eqn = Vgi - Vfb - Vs - (Q(11.7)/k)*((2*Q(0.026)*p*Q(1.6)*10^-19)/(Q(11.7)*Q(8.85)*10^-14))^Q(0.5)*(d*Q(11.7)/k)*(exp(-Vs/Q(0.026))+(Vs/Q(0.026))-1+(Q(1.5)*10^10/p)^2*(exp(Vs/Q(0.026))-(Vs/Q(0.026))-1))^Q(0.5);
thissol = vpasolve(eqn,Vs);
if isempty(thissol)
Sol(i,2) = nan;
else
Sol(i,2) = vpa(thissol,5);
guess = thissol;
end
Sol(i,:)
end
delete(wb)
disp(Sol)
Hasan canar
on 19 Feb 2021
I guess ıt does not compensate my expectations. For the range Vg (-15 to -6.14) I shoul have seen negative Vs values, obviously I got NaN, but I guarantee that there must be physical solution. For the Vg(-6.14 to +10 or so on) I should have got positive Vs values. Lowest Vs + Highest Vs = should be around 1.12.
For the range -6.14 to +10 I just got negative results which does not make sense. I dont know what is going on with the code or function.
Hasan canar
on 20 Feb 2021
Edited: Hasan canar
on 20 Feb 2021
@Walter Roberson I tried to expand exp functions in taylor series but by increasing the series terms, for the same Vg, Vs gets even smaller and smaller.
clear all
syms Vs Vg
%{
k = input('k (dielectric constant):')
p = input('p (doping const.):')
Vfb = input('Vfb :')
d = input('d (dielectric thick.):')
%}
k = 3.73;
p = 3.1e16;
Vfb = -5.65;
d = 95e-7;
n = input('Taylor Terms :')
Vg = [
0
];
A = (1/k)^2*sqrt((2*0.026*p*1.6e-19)/(11.7*8.85e-14))*d;
B = (1.5e10/p)^2;
f_1 = exp(-Vs/0.026);
func_1 = taylor(f_1,'Order',n)-taylor(f_1,'Order',2);
f_2 = exp(Vs/0.026);
func_2 = taylor(f_2,'Order',n)-taylor(f_2,'Order',2);
guess = -0.074;
for i = 1:length(Vg)
eqn(i) = vpasolve(Vs == Vg(i) - Vfb - A*(func_1 + B*func_2)^0.5, Vs,guess);
end
subs(eqn)
for Vg = Vfb, I got something e-43 which makes 0 and sadly, does not solve beyond -5.68( not -5.60).
For Vg = 0, by expanding series, Vs is also increasing (obviously It's real part) I got complex root for that. What is the reason of increase in Vs? It should stop around a point.
Also, absolute value of the complex roots should be the same , ıs nt it ? They are even different...
Walter Roberson
on 20 Feb 2021
For the Vg(-6.14 to +10 or so on) I should have got positive Vs values
Let us investigate:
d = 95e-7;
p = 5.095e16;
k = 3.73;
Vfb = -6.14;
syms Vg Vs
i = 1;
eqn = Vg(i) - Vfb - Vs - ((11.7)/k)*((2*(0.026)*p*(1.6)*10^-19)/((11.7)*(8.85)*10^-14))^(0.5)*(d*(11.7)/k)*(exp(-Vs/(0.026))+(Vs/(0.026))-1+((1.5)*10^10/p)^2*(exp(Vs/(0.026))-(Vs/(0.026))-1))^(0.5)
eqn =

What sort of value would Vg(i) have to be in order for Vs = 1/1000 to be the solution?
Vg1000 = vpasolve(subs(eqn, Vs, 1/1000), Vg, -6)
Vg1000 = 
vpasolve(subs(eqn, Vg, Vg1000), Vs)
ans = 
Oh dear, we did not get back the same 1/1000 . Perhaps we need to hint?
vpasolve(subs(eqn, Vg, Vg1000), Vs, 1/72)
ans = 
vpasolve(subs(eqn, Vg, Vg1000), Vs, 1/73)
ans =
0.001
So you can get the positive solution... but you have to start pretty close to the solution.
Is the negative value wrong?
eqn2 = subs(eqn, Vg, 0);
fplot(eqn2, [-0.14, 0.9])

No, we can see that although the function is not symmetric, that except for the peak, for every y value there are two x (Vs) values that give that result.
The y axes here is the negative of the Vg: so for Vg = 10, then when you add the negative 10 you get for Vs about -0.11, you would get 0; so Vg = 10, Vs about -0.11 is a solution to the equation. But also for Vg = 10, the negative 10 you get for Vs about 0.85 would give you a total of 0, so Vg = 10, Vs roughly 0.85 is also a solution.
Likewise, reading the part above the 0, we see that there are two solutions for each Vg in the range 0 to -6.14 .
And... this also means that there are no real-valued solutions for Vg < -6.14 .
For the range Vg (-15 to -6.14) I shoul have seen negative Vs values
No, graph the function and you will see that you cannot get those.
Vgsol = solve(eqn, Vg);
fplot(Vgsol, [-0.14, 0.9]); xlabel('Vs'); ylabel('Vg')

If you seem to find you get a solution with taylor expansion, then it could only be due to the limitations of taylor expansion in dealing with infinite functions.
I recommend that you go back and triple-check the equations and the constants being used.
Hasan canar
on 20 Feb 2021
@Walter Roberson So, you can solve Vg < -6.14 and get negative values for Vs. But, I get NaN everytime. Why ? What did I wrong ?
Walter Roberson
on 20 Feb 2021
No, I made it clear that Vg < -6.14 has no real solutions.
d = 95e-7;
p = 5.095e16;
k = 3.73;
Vfb = -6.14;
syms Vg Vs
i = 1;
eqn = Vg(i) - Vfb - Vs - ((11.7)/k)*((2*(0.026)*p*(1.6)*10^-19)/((11.7)*(8.85)*10^-14))^(0.5)*(d*(11.7)/k)*(exp(-Vs/(0.026))+(Vs/(0.026))-1+((1.5)*10^10/p)^2*(exp(Vs/(0.026))-(Vs/(0.026))-1))^(0.5)
eqn =

Vgsol = solve(eqn, Vg);
VS = linspace(-0.14, 0.9, 500);
VG = double(subs(Vgsol, Vs, VS));
plot(VG, VS);
xlabel('Vg');
ylabel('VS')

[minvg, minidx] = min(VG);
fprintf('Minimum Vg was %g at Vs = %g\n', minvg, VS(minidx));
Minimum Vg was -6.12176 at Vs = -0.000360721
(Not exactly -6.14 because of the limitations of linspace for that many points.)
Your function has a exp(A*Vs) and an exp(-A*Vs) and a linear term and a constant. With that linear term, you could hope that it might cross zero twice, but that does not happen: it happens to balance out exactly at 0. And if you move away from zero in a positive direction, the exp(A*Vs) gets large quickly, and if you move away from zero in a negative direction, the exp(-A*Vs) gets large quickly. So.. there is just no possibility of extending further back than -6.14
Hasan canar
on 21 Feb 2021
Literature says that for my equation, If I solve it numerically, I should get symmetric figure and for Vg<-6.14 there should exist Vs<0.
Walter Roberson
on 21 Feb 2021
Look at the output of eqn in https://www.mathworks.com/matlabcentral/answers/739187-eqn-solver-could-not-solve-my-specific-seqn#comment_1342594
Look inside the sqrt and observe that you have a constant times Vs, and then you have exp(-500/26*Vs) and those terms are added together. The result cannot be symmetric around 0 because the constant times Vs contributes negative for negative Vs and contributes positive for positive Vs.
As you have now triple checked the equations, we are left with the conclusion that the paper is incorrect and needs to be withdrawn. Would you prefer to write your refutation to the journal, or to the authors directly, or would you prefer to have me send a formal refutation to the authors of the paper, citing your important role in bringing the flaw to attention?
Hasan canar
on 21 Feb 2021
This is what I got when I run your previous code Vg =[ -6, -5.9 ... +9.9, +10]. How come you get positive Vs values ?

See Also
Categories
Find more on Logical 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!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)