Solve Integral Equation with function handles
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponse acceptée
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
Plus de réponses (0)
Voir également
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!