solve() is unable to find a solution

1 vue (au cours des 30 derniers jours)
SOURAV KUMAR
SOURAV KUMAR le 26 Mar 2021
Commenté : Alan Stevens le 14 Avr 2021
Hello everyone,
I was trying to solve a transcendental eqation in MATLAB
I performed two programs one graphical approach and another by solve()
In the graphical approach, I find one solution exists in the range () for , as shown in the figure below
i.e., the intersection of blue and red curve ()
Now, when i performed another program (T2.m) using solve() :
Command Prompt is giving empty sym with the following message:
Warning: 3 equations in 1 variables.
> In C:\Program Files\MATLAB\R2013a\toolbox\symbolic\symbolic\symengine.p>symengine at 56
In mupadengine.mupadengine>mupadengine.evalin at 97
In mupadengine.mupadengine>mupadengine.feval at 150
In solve at 170
In T2 at 16
Warning: Explicit solution could not be found.
> In solve at 179
In T2 at 16
k1_sol = [ empty sym ]
My T2.m is as follows:
clc
clear all
close all
one_eV= 1.6/(10^19);
Vo=0.3 * one_eV;
b=5/(10^9);
S=Vo*b;
a=10/(10^9);
m=0.067 * 9.1/(10^31);
h=6.626/(10^34);
hbar= h/(2*pi);
k=pi/(4*a);
lhs= cos(k*a);
syms k1
rhs=cos(k1*a) + (m*S)*sin(k1*a)/(hbar^2 * k1);
k1_sol= solve(lhs== rhs,k1 >= 0.27*(10^9), k1 <= 0.32*(10^9))
so, how to rectify this?

Réponse acceptée

Alan Stevens
Alan Stevens le 26 Mar 2021
Just solve it numerically using fzero. Take the initial guess close to the average value of the bounds you specify:
k1_0 = 0.29E9; % initial guess
k1 = fzero(@k1fn,k1_0);
disp(k1)
disp(cos(pi/4)) % = cos(k*a)
function Z = k1fn(k1)
one_eV= 1.6/(10^19);
Vo=0.3 * one_eV;
b=5/(10^9);
S=Vo*b;
a=10/(10^9);
m=0.067 * 9.1/(10^31);
h=6.626/(10^34);
hbar= h/(2*pi);
k=pi/(4*a);
Z = cos(k1*a) + (m*S)*sin(k1*a)/(hbar^2 * k1) - cos(k*a);
end
this reults in
2.7859e+08 for k1 and 0.7071 for left and right hand sides of your equation.
  2 commentaires
SOURAV KUMAR
SOURAV KUMAR le 14 Avr 2021
@Alan Stevens can you please tell me why solve() is not able to find the solution?
Alan Stevens
Alan Stevens le 14 Avr 2021
I don't know!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Produits


Version

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by