Solve Integral Equation with function handles

1 vue (au cours des 30 derniers jours)
DA
DA le 8 Déc 2019
Commenté : Star Strider le 8 Déc 2019
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?

Réponse acceptée

Star Strider
Star Strider le 8 Déc 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 commentaires
DA
DA le 8 Déc 2019
Thank you very much for your quick response!
This solved the problem!
Star Strider
Star Strider le 8 Déc 2019
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Applications dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by