How can i solve equation with integral and unknown?

6 views (last 30 days)
Hi, I have huge problem with following equation:
f=@(ksi) ( ksi.^0.5/(1+exp(ksi-(-(Ec-Efn)/kb/T))));
eqn = Nc*2/sqrt(pi)*integral(f,0,Inf) == Nd/(2+exp((Efn-Ed)/kb/T));
Efn is to evaluate. kb, T, Nc, Nd, Ec, Ed are given. ksi is from 0 to infinity in integral.
Can anyone help me to find a solution?

Answers (1)

Star Strider
Star Strider on 19 May 2018
I have no idea what you are doing.
This runs:
[kb, T, Nc, Nd, Ec, Ed] = deal(3,5,7,11,13,17); % Create Scalar Constants
f = @(ksi,Efn) ( ksi.^0.5/(1+exp(ksi-(-(Ec-Efn)/kb/T))));
eqn = @(Efn) Nc*2/sqrt(pi)*integral(@(ksi)f(ksi,Efn),0,Inf, 'ArrayValued',1) - Nd/(2+exp((Efn-Ed)/kb/T));
Efnval = fzero(eqn, 10);
Since you are integrating with respect to ‘ksi’ and apparently want to solve for ‘Efn’, it is necessary to create ‘f’ as a function of both variables. The integral call then integrates with respect to ‘ksi’, and the fzero function solves for ‘Efn’ in the entire expression of ‘eqn’. The ‘double equal’ (==) creates a logical equality comparison, not the arithmetic equality that it does in the Symbolic Math Toolbox, and since I infer that you want to solve for the two expressions in ‘eqn’ to be equal, one way of doing that is to subtract them instead, and solve for the value of ‘eqn’ at the zero-crossing, which is what my code does.
Experiment with my code to get the result you want.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!