I have a nonlinear equation ,, which i didn't know how to put it in matlab

6 views (last 30 days)
the equation
x exp x = [(segma / KB * T ) ^ 2 - x ]* (tr/ttr) * exp(E0 - Ea)/KB * T
while :
segma = 13 , KB =8.617*10^-5 , tr= 250 , ttr= 0.027 , E0=1.185 , Ea=E0+0.073
T=0:300
and the other one is
E(T)= E0 -(0.00000048 * T^2) /(270 + T) - x * KB *T
while
E0=1.185 , KB =8.617*10^-5 and also T =0:300
can any one help me with it please
  2 Comments
beso ss
beso ss on 1 Mar 2018
i need to give a result for each x ,, that is means for every T there is an x for it ,,, if i but the other elemnts to the equation it will be
x exp x = [ ( 13 / 8.617*10^-5 * T )^2 - x ] * ( 250/0.027 ) * exp[ ( 0.073 ) / 8.617*10^-5 * T ]
there is still x and T but T change from 0 to 300
is it clear now href = ""</a>>>/?????

Sign in to comment.

Answers (6)

John D'Errico
John D'Errico on 2 Mar 2018
Edited: John D'Errico on 2 Mar 2018
You responded to my question without explaining what E(T) has to do with anything.
So is it clear? Not fully. It seems you have written TWO equations, one for E(T) which seems to be used for nothing.
The first equation can be solved (IF a solution exists) using fzero. Thus, for EACH value of T, you will solve the problem independently. A loop would suffice, and there is no real reason to do anything more sophisticated than a loop.
T = 0:300;
X = zeros(size(T));
syms x
for n = 1:numel(T)
Eqn1 = x*exp(x) == [(segma / KB * T(n) ) ^ 2 - x ]* (tr/ttr) * exp(E0 - Ea)/KB * T(n);
X(n) = double(vpasolve(Eqn1,x));
end
The above solution could also have been trivially written to use fzero.
  14 Comments
beso ss
beso ss on 4 Mar 2018
Edited: beso ss on 4 Mar 2018
yes i know that the value of E1 it will be so tiny ,, but not equal to 1.185 it will be smaller than it ,,, it will be around 1 and 1.185 , and also ,,E1 and E2 don't have to be the same result
John D'Errico
John D'Errico on 4 Mar 2018
Edited: John D'Errico on 4 Mar 2018
They Are NOT the same result!!!!!!!
format long g
E1 = 1.185-(0.00000048*T.^2)./(270+T);
E1(1:5)
ans =
1.185 1.18499999822878 1.18499999294118 1.18499998417582 1.1849999719708
E2(1:5)
ans =
1.185 1.18499999822878 1.18499999294117 1.18499998417581 1.18499997197075
Are they the same? No. Are they close as hell to each other? Of course. Because those other terms are SO small.
Consider E1.
It was computed from
E1 = 1.185-(0.00000048*T.^2)./(270+T);
So plot that second term in E1.
plot(T,(0.00000048*T.^2)./(270+T))
Look carefully at the y axis. Do you see on top the 10^-5 there?
That means all the elements in that plot are on the order of 8*10^-5, or SMALLER. So if we add 1.185 to a number that is SMALLER than 0.00001, and usually MUCH smaller than that, what do you expect to see?
How about E2? E2 is the same as E1. Except is has that term with X in it.
E2 = 1.185 - (0.00000048 * T.^2) ./ (270 + T) - 8.617e-5*X.*T;
Plot that last term now. Remember to look carefully at the y axis. Remember to look at the exponent attached to that axis. Do you see the 10^-7 there? That means that every number in that plot was smaller than 8e-7, but that the elements on the far left are FAR smaller than that.
plot(T,8.617e-5*X.*T)
Here are the first 5 elements of that term.
8.617e-5*X(1:5).*T(1:5)
ans =
0 2.24110912198165e-16 3.54526286107169e-15 1.77473849967693e-14 5.5470798356365e-14
Now, when you subtract a number of that size from 1.185, what do you expect to see?
Think abut what you are doing. Look carefully at the numbers involved.

Sign in to comment.


beso ss
beso ss on 4 Mar 2018
can anyone answer me please
  2 Comments
beso ss
beso ss on 4 Mar 2018
im sorry :( ,,,, thank you sooooo much ,,, some times i am so rush and i didn't git the hall answer in the same time ,, it comes separate ,,,
thank you all again very much

Sign in to comment.


beso ss
beso ss on 17 Mar 2018
Edited: Walter Roberson on 17 Mar 2018
Hi , it is me again
can i use another way to have numerically solve for the equation
syms x
X = zeros(size(T));
for n = 1:numel(T)
Eqn1 = x*exp(x) ==(( 13 / 8.617*10^-5 * T(n) )^2 - x ) * ( 250/0.027 ) * exp ( 0.073 ) / 8.617*10^-5 * T(n) ;
X(n) = double(vpasolve(Eqn1,x));
end
becouse in the plot there is a mistake i dont know way
the original equation is
x*exp(x) = (((sigma/(KB*T(i)))^2-x)*(tautr/taur)*exp(deltaE/(KB*T(i)))
where
sigma = 13*10^-3; %eV
deltaE = -0.073; %eV
E0 = 1.185; %eV
tautr = 0.027;
taur =250;
KB= 8.617*10^-5; %eV/K
T= 0:300
  54 Comments

Sign in to comment.


beso ss
beso ss on 21 Mar 2018

Yi-Lin Tsai
Yi-Lin Tsai on 4 May 2018
I have a nonlinear equation I see some references but i don't know to get each value about sigma tautr taur please help me
  2 Comments
Walter Roberson
Walter Roberson on 4 May 2018
You should start a new Question on that topic. Be sure to include a copy of the equations.
beso ss
beso ss on 4 May 2018
Edited: beso ss on 4 May 2018
ok i will ,i am going to write a new question.
thanks

Sign in to comment.


khouloud abiedh
khouloud abiedh on 3 Jul 2018
Edited: Walter Roberson on 4 Jul 2018
hello ,i m debutant in matlab and i need to do a fit of my experimental data by LSE model in matlab iwrite the last comment i write the same code of the energetic position of a gaussian but i find a problem to do an exact fit of the data by matlab ,also i need to do a fit of the LMH of the gaussian by this model in matlab .when i read the article i understand that it must resolve another equation numerically to find the LMH described in the LSE model.i use the same code but i change the equation but it display an error.i need our help please help me and thank you in advance.
%%trouver x et tracer la position energetique
sigma = 13*10^-3;%eV
deltaE = -73e-3;%eV
E0 = 1.185;%eV
Ea = E0+75e-3;
tautr=0.027 ;
taur=250;
Kb = 8.617*10^-5;%eV/K
theta = 270; %K
alfa = 0.48e-3;%eV/K
T= 0:10:300;
X = zeros(size(T));
E2 = zeros(size(T));
E1= zeros(size(T));
a = zeros(size(T));
syms x
for i=1:numel(T)
E1(i) = E0 -( alfa*T(i)^2)/(theta+T(i));
X(i) = vpasolve(((sigma/(Kb*T(i)))^2 - x)*(taur/tautr)*exp(deltaE/(Kb*T(i)))-x*exp(x)==0,x);
E2(i) = E0 -(alfa*T(i)^2)/(theta + T(i))-X(i)*Kb*T(i);
a(i) = X(i)*Kb*T(i);
end
figure(1);plot(T,E1,'r.');
figure(2);plot(T,E2,'g')
hold on ;plot(T,E1,'r')
figure(3);plot(T,X,'k.','Markersize',5)
figure(4);plot(T,a,'k');
%%to find LMH i must resolve n(E0-X(T)*Kb*T,T)/2=n(E,T)
trouver n(E0-X(T)*Kb*T,T)/2
n(E,T)= exp(-(E(i)-E0)^2/(2*sigma^2)/(exp((E(i)-Ea)/(Kb*T(i)))+(tautr/taur)))
E = zeros(size(T));
n = zeros(size(T));
n1=zeros(size(T));
for i=1:numel(T)
E(i)= E0-a(i);
n(i)=exp(-(E(i)-E0).^2/(2*sigma^2))/(exp((E(i)-Ea)/(Kb*T(i)))+(tautr/taur));
n1(i)=n(i)/2;
end
figure (5)
plot(E1,n1)
X1=zeros(size(T));
syms x1
for i=1:numel(T)
X1(i) = vpasolve(exp(-(E(i)-E0)^2/(2*sigma^2))/(exp((E(i)-Ea)/(Kb*T(i)))+(tautr/taur))-n1(i)==0,x1);
end
figure(6);plot(T,X1,'r.')
  3 Comments
khouloud abiedh
khouloud abiedh on 7 Jul 2018
hello dear Walter Roberson i start a new question in this topic i tag you but i don't know if i do a fault and i tag another person.

Sign in to comment.

Categories

Find more on Nonlinear Analysis in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!