How can take an integral for a dependent expression?

1 次查看(过去 30 天)
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

回答(1 个)

Torsten
Torsten 2014-12-5
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 个评论
Torsten
Torsten 2014-12-9
If you don't like the analytical expression for your integral, maybe
is of help.
Best wishes
Torsten.
Jarett
Jarett 2014-12-9
Torsten,
Thanks for the advice. Solved my issue, simply was missing a period to compute element wise. Thanks for the attention though.
-Jarett

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by