Solve Integral Equation with function handles

4 visualizzazioni (ultimi 30 giorni)
Hey everyone!
I am facing a problem. I want to get at the end a value for the variable flux.
dpsi = -5;
etaK = 2;
etaL = 4;
j0 = 1;
UT = 1;
syms flux
Fermi =@(eta) sqrt(pi)./ (2 .* (3/4 .* sqrt(pi) .*( eta.^4 + 33.6.*eta *(1.0-0.68.*exp(-0.17*(eta+1).^2) ) + 50).^(-3/8) + exp(-eta) ));
InnerInt = @(eta, flux) 1/ ( flux/Fermi(eta) + dpsi/UT);
integralEq = @(flux) integral( @(eta) InnerInt(eta, flux), etaK, etaL);
jKG = j0 * solve( integralEq(flux) == 1);
Can someone please help me?

Risposta accettata

Star Strider
Star Strider il 8 Dic 2019
Every multiplication in ‘Fermi’ needs to be vectorised (with element-wise operations), the Symbolic Math Toolbox is not necessary, (so replace solve with fsolve), and use the ArrayValued name-value-pair in the integral call.
With those changes, your code:
dpsi = -5;
etaK = 2;
etaL = 4;
j0 = 1;
UT = 1;
Fermi = @(eta) sqrt(pi) ./ (2 .* (3/4 .* sqrt(pi) .*( eta.^4 + 33.6.*eta .* (1.0-0.68.*exp(-0.17*(eta+1).^2) ) + 50).^(-3/8) + exp(-eta) ));
InnerInt = @(eta, flux) 1/ ( flux/Fermi(eta) + dpsi/UT);
integralEq = @(flux) integral( @(eta) InnerInt(eta, flux), etaK, etaL, 'ArrayValued',1);
jKG = j0 * fsolve(@(x) integralEq(x) - 1, 10)
now produces this result:
jKG =
-3033.2578125
  2 Commenti
DA
DA il 8 Dic 2019
Thank you very much for your quick response!
This solved the problem!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by