フィルターのクリア

solve() is unable to find a solution

1 回表示 (過去 30 日間)
SOURAV KUMAR
SOURAV KUMAR 2021 年 3 月 26 日
コメント済み: Alan Stevens 2021 年 4 月 14 日
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?

採用された回答

Alan Stevens
Alan Stevens 2021 年 3 月 26 日
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 件のコメント
SOURAV KUMAR
SOURAV KUMAR 2021 年 4 月 14 日
@Alan Stevens can you please tell me why solve() is not able to find the solution?
Alan Stevens
Alan Stevens 2021 年 4 月 14 日
I don't know!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

製品


リリース

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by