Warning: Cannot find explicit solution

Hi, I have to solve this equation: x*cot(x)-1+(ke*R/Dm). Where ke= 3.7*10^-5, R=2*10^-4 and Dm=12.6*10^-19. When I use solve matlab give me this error: 'Warning: Cannot find explicit solution.'. Can you help me?

 Respuesta aceptada

John D'Errico
John D'Errico el 12 de Nov. de 2018
solve is telling you that no analytical solution exists. That is what you tried to do, is it not? Do you assume that all equations have such a solution?
First, I would recommend that you learn to use scientific notation in the form I show. It will make your code easier to read, write, and follow.
ke = 3.7e-5;
R = 2e-4;
Dm = 12.6e-19;
ratio = ke*R/Dm
ratio =
5.873e+09
So, first, note that the ratio you have written is quite a large number in comparison to 1, yet you are then subtracting 1 from that. That itself will cause a potential problem in terms of accuracy, since MATLAB will compute that result as a DOUBLE precision number, then subtract 1.
In fact, see that you get a different result even if you do these seemingly similar things:
ratio = sym(ke*R/Dm)
ratio =
1539575873015873/262144
ratio = sym(ke)*R/Dm
ratio =
24014372970723576557818871808/4088933776096176875
syms x
fun = x*cot(x)-1 + ratio;
As you should expect, this will have infinitely many zeros, since it contains the cot function.
ezplot(fun)
The first real positive solution seems to lie roughly near pi from the plot, but vpasolve does not know which of infinitely many solutions it should search for.
vpasolve(fun)
ans =
-6029099.5755159751256227152413773
Telling it to look near pi helps.
vpasolve(fun,[2 4])
ans =
3.1415926530548734082568136811652
format long g
pi
ans =
3.14159265358979
So just a tiny bit less than pi, if you know the first dozen digits of pi.

Más respuestas (1)

Torsten
Torsten el 12 de Nov. de 2018
Editada: Torsten el 12 de Nov. de 2018
format long
deltax = 1e-13;
n = 100;
ke = 3.7e-5;
R = 2e-4;
Dm = 12.6e-19;
fun = @(x)x.*cot(x)-1+ke*R/Dm;
for i=1:n
left=(i-1)*pi+deltax;
right=i*pi-deltax;
sol(i)=fzero(fun,[left right]);
end
sol
fun(sol)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by