Using Fminsearch to solve equation

20 views (last 30 days)
Hello,
I need your help to use fminsearch to solve this equation, I did not know how to solve it, because I'm a beginner in Matlab.
Best regard,

Accepted Answer

Walter Roberson
Walter Roberson on 15 Apr 2019
Generally speaking,
f(x) = constant
can be solved by minimizing
(f(x) - constant)^2
This approach can be used with multiple variables.
The difficulty is in finding a starting point for the search. Different minimizers have different algorithms but in practice all of the local minimizer can get stuck in local minima. (Theory does say that Simulated Annealing will find the global minimum if given enough time but the time required might be many times the expected lifetime of the Universe)
  3 Comments
MAROUANE ENNAGADI
MAROUANE ENNAGADI on 3 May 2019
Thank you so much for your reponse, I tried to solve it and I find some errors:
% Main Principal :
% Données:
sigma=0.1;
e=1.6e-19;
N=10.^26;
E_LUMO=0;
K_B=8.625e-5; % Constante de Boltzman
T=300; % Témperature Ambiante
Bc=2.735;
Alpha=0.215*N.^(-1./3); % the localization length
Ef=E_LUMO-0.5; % Energie de Fermi
% Valeur de départ Et0 :
E_t_0=0;
% Bornes d'integration en Energie:
E1=-10*sigma;
N_0=1000;
E=linspace(E1,Et,N_0);
% Calcul de Et:
Et=fminsearch('F_min',E_t_0,[],Bc,K_B,T,Alpha);
My Fonctions are :
function [Gauss]=densite_Gaussienne(N,sigma,E,E_LUMO)
Gauss=N./(sigma*sqrt(2*pi)).*exp(-(E-E_LUMO).^2./(2*sigma^2));
end
function [S_F_D]=statistque_Fermi_Dirac_1(E,Ef,K_B,T)
S_F_D=1-(1./(1+exp((E-Ef)./(K_B*T))));
end
function [Multi_G_F_D]=multiplication_G_D_1(Gauss,S_F_D)
Multi_G_F_D=Gauss.*S_F_D;
end
% Calcul de nt:
function [nt]=n_t_1(E,Multi_G_F_D)
nt=trapz(E,Multi_G_F_D);
end
function F=F_min(Et,Bc,K_B,T,Alpha,E1,N_0)
E=linspace(E1,Et,N_0);
nt=trapz(E,Multi_G_F_D);
F=abs((2/3)*(4.*pi/3*Bc).^-1/3.*(K_B*T./Alpha).*(nt).^-4/3.*(1-(1./(1+exp((Et-Ef)./(K_B*T)))).*(N./(sigma*sqrt(2*pi)).*exp(-(Et-E_LUMO).^2./(2*sigma^2))))-1);
end
Best regard,

Sign in to comment.

More Answers (0)

Categories

Find more on Econometrics Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!