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

2 次查看(过去 30 天)
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 个评论
beso ss
beso ss 2018-3-1
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>>>/?????

请先登录,再进行评论。

回答(6 个)

John D'Errico
John D'Errico 2018-3-2
编辑:John D'Errico 2018-3-2
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 个评论
beso ss
beso ss 2018-3-4
编辑:beso ss 2018-3-4
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 2018-3-4
编辑:John D'Errico 2018-3-4
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.

请先登录,再进行评论。


beso ss
beso ss 2018-3-4
can anyone answer me please
  2 个评论
beso ss
beso ss 2018-3-4
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

请先登录,再进行评论。


beso ss
beso ss 2018-3-17
编辑:Walter Roberson 2018-3-17
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 个评论

请先登录,再进行评论。


beso ss
beso ss 2018-3-21

Yi-Lin Tsai
Yi-Lin Tsai 2018-5-4
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

khouloud abiedh
khouloud abiedh 2018-7-3
编辑:Walter Roberson 2018-7-4
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 个评论
khouloud abiedh
khouloud abiedh 2018-7-7
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Nonlinear Analysis 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by