Why do I get empty result?

Hello all,
I have the following equation that needs to be solved by MATLAB but it gives me empty sym. I don't know why
syms T a b
eqn= (a*b*exp(b/T)*((1 - exp(a*b*ei(b/T) - T*a*exp(b/T))*exp(294*a*exp(b/294) - a*b*ei(b/294))) - 1))/T^2 == 0;
solT = solve(eqn,T)
Even when I give values for a and b, MATLAb gives me the same message:
syms T
a=(exp(183.8)/1.5);
b=-6.2662e+04;
eqn= (a*b*exp(b/T)*((1 - exp(a*b*ei(b/T) - T*a*exp(b/T))*exp(294*a*exp(b/294) - a*b*ei(b/294))) - 1))/T^2 == 0;
solT = solve(eqn,T)
I would be thankful if someone help me with this.

6 个评论

It's too complicated for symbolic calculations. Try numerical - fsolve
I changed my code as follows:
clc
clear all
%Substitute n(T) from the abobe solution into d2n/dT2
syms T
a=(exp(183.8)/1.5);
b=-6.2662e+04;
odefun = @func;
x0 = [300];
x = fsolve(odefun,x0);
% eqn= (a*b*exp(b/T)*((1 - exp(a*b*ei(b/T) - T*a*exp(b/T))*exp(294*a*exp(b/294) - a*b*ei(b/294))) - 1))/T^2 == 0;
%
% solT = solve(eqn,T)
function F = func(x)
a=(exp(183.8)/1.5);
b=-6.2662e+04;
F(1) = (a*b*exp(b/x(1))*((1 - exp(a*b*ei(b/x(1)) - x(1)*a*exp(b/x(1)))*exp(294*a*exp(b/294) - a*b*ei(b/294))) - 1))/x(1)^2 == 0;
end
But it gives the message that "FSOLVE requires all values returned by functions to be of data type double". I don't know why
Now it works. But it gives the initial point (x=300) as the final answer which is incorrect.
I draw you function
a = (exp(183.8)/1.5);
b = -6.2662e+04;
F = @(x) (a*b*exp(b/x)*((1 - exp(a*b*ei(b/x) - x*a*exp(b/x))*exp(294*a*exp(b/294) - a*b*ei(b/294))) - 1))/x^2;
x = linspace(100,400);
y = arrayfun(F,x);
plot(x,y)
% x0 = [300];
% x = fsolve(odefun,x0);
ylim([-1 1]*0.1)
Result
Thanks. Then how can I find the peak? My ultimate goal is to find the peak in terms of a and b

请先登录,再进行评论。

回答(1 个)

Steven Lord
Steven Lord 2020-5-4

0 个投票

When I display the expression in the Live Editor, I see that the numerator of the expression is the product of a (very large) constant positive value and two exponentials. That numerator, divided by T^2, is supposed to be equal to 0.
The constant is positive. The values of the two exponentials are only 0 in the limit; there's no finite value z for which exp(z) is 0.
So MATLAB correctly gave the answer that there is no solution to your equation as written.
Your expression does look a little unusual, though. Did you intend to have the Ei and one of the exponentials inside the exponent of another exponential call? Maybe there's a parenthesis in the wrong place?

1 个评论

Actually what I am trying to do is as follows:
I have a diferential equation which has the following form:
when I solved this (with a and b known) and thenfind dy/dT in terms of T, it becomes a figure like this:
I am trying to find the peak in terms of a and b. So, firstly I solved my differential equation symbollicaly in MATLAB to find y(T), then I differentiate dy/dT once more to find dy2/dT2 in terms of y and T. Then I substituted y(T) which had been obtained previously in it. So, my equation would only be in terms of T and then I want to put it equal to zero to find the peak in terms of a and b. but here I substituted my experimental value for a and b o check my answer. So, all I found is from MATLAB

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by