eqn solver could not solve my specific seqn

4 visualizzazioni (ultimi 30 giorni)
Hasan canar
Hasan canar il 8 Feb 2021
Commentato: Tatti Singh il 28 Feb 2021
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

Risposte (4)

Walter Roberson
Walter Roberson il 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 Commenti
Hasan canar
Hasan canar il 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
Walter Roberson il 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

Accedi per commentare.


Hasan canar
Hasan canar il 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 Commenti
Hasan canar
Hasan canar il 10 Feb 2021
Modificato: Hasan canar il 10 Feb 2021
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
Walter Roberson il 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

Accedi per commentare.


Hasan canar
Hasan canar il 11 Feb 2021
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 Commenti
Hasan canar
Hasan canar il 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
Walter Roberson il 21 Feb 2021
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?

Accedi per commentare.


Hasan canar
Hasan canar il 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 ?

Community Treasure Hunt

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

Start Hunting!

Translated by