Effacer les filtres
Effacer les filtres

How can take an integral for a dependent expression?

2 vues (au cours des 30 derniers jours)
Jarett
Jarett le 4 Déc 2014
Commenté : Jarett le 9 Déc 2014
I am trying to take the integral of an expression and am running into trouble on how to do it symbolically. I have used the trapz method and it works, however in following work this method seems to be inadequate. I have included my script for reference, ultimately I want to take the integrals denoted as Qsfun and Qcfun which are dependent on the variables xg and Vg. Thanks in advance for any insight and help.
Script
Vg = linspace(1.5e-1, 5, 3000);%Energy gap defined by us, allows optimization of where the cell has the highest efficiency.
for t = 1:length(Vg)
xg(t) = (q*Vg(t)) /(k*Ts); %Xg value operating on the energy gap value and dependent on the temp of the sun.
xgc(t) = (q*Vg(t)) /(k*Tc); %Xg value operating on the energy gap value and dependent on the temp of the cell.
x = linspace(xg(t),1000, 10000);%Size iteration of x based on values xg(t) to 1000, with 10000 interval points
for l = 1:length(x);
Qsfun(l) =(x(l)^2)/(exp(x(l))-1);
end
a = linspace(xgc(t),30*xgc(t), 30000);%Size iteration of a based on values xgc(t) to 30*xgc, with 30000 interval points
for y = 1:length(a);
Qcfun(y) =(a(y)^2)/(exp(a(y))-1);
end
Intqs(t) = trapz(x,Qsfun);
Intqc(t) = trapz(a,Qcfun);
%Iqs(t) = xg*trapz(x,Qsfun);
%Iqc(t) = xg*trapz(x,Qcfun);
%The number of quanta of frequency greater than vg incident per unit area time
Qs(t) = ((2*pi*((k*Ts)^3))/((h^3)*(c^2)))*Intqs(t);
Qc(t) = ((2*pi*((k*Tc)^3))/((h^3)*(c^2)))*Intqc(t);
b = linspace(1e-10, 100, 3000);
for mm = 1:length(b)
Psfun(mm) = (b(mm)^3)/(exp(b(mm))-1); %Function of Plancks distribution integral
end
IntPs = trapz(b,Psfun);
u(t) = (xg(t)*Intqs(t))/IntPs;
end

Réponses (1)

Torsten
Torsten le 5 Déc 2014
I get
2*x*Polylog(2,exp(x))-2*Polylog(3,exp(x))-x^3/3+x^2*log(1-exp(x))
for the integral of
x^2/(exp(x)-1)
Take a look at
for more information about the polylogarithm.
Best wishes
Torsten.
  3 commentaires
Torsten
Torsten le 9 Déc 2014
If you don't like the analytical expression for your integral, maybe
is of help.
Best wishes
Torsten.
Jarett
Jarett le 9 Déc 2014
Torsten,
Thanks for the advice. Solved my issue, simply was missing a period to compute element wise. Thanks for the attention though.
-Jarett

Connectez-vous pour commenter.

Catégories

En savoir plus sur Numerical Integration and Differentiation 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