要积分的函数是FluxDensity?? 变量是Energy,phy??如果是的话,看如下示例:
1)新建个函数文件,
function FluxDensity = f( Energy, phy )
Ee=0.8; I=0.3; B=1.2;
gama=1957*Ee;
Ec=0.665*Ee^2*B;
y=Energy/Ec;
a=gama^2*phy.^2;
b=1+a;
kexi=1/2*y.*b.^(3/2);
FluxDensity=1.327E13*Ee^2*I*b.^2.*(BesselK(2/3,kexi).^2+a./b.*BesselK(1/3,kexi).^2);
end
2)固定phy为2,求Energy积分(0到1):
quad(@(E)f(E,2), 0, 1)