我想解决具有无限边界的双积分。经过一段时间的计算,MatLab告诉我“达到了最大使用间隔数的极限。误差的近似界限为2.1e + 07.积分可能不存在,或者可能难以按数字逼近所要求的准确性。”我的代码是
%%%%%%%%%
close all;
clear all;
format long;
e=1.60217653*10^(-19);
h=6.6260693*10^(-34);
hbar=h/(2*pi);
m=9.1093826*10^(-31);
T=293.15;
k_B=1.38065*10^(-23);
rho=1.5*10^(-2);
delta=7.4*10^(-6);
L=0.01;
U_b=1665;
v=sqrt((2*e*U_b)/m);
c=299792458;
lambda=h/(sqrt(2*m*e*U_b));
epsilon_0=8.854187817*10^(-12);
omega_P=7.88*10^(12);
gamma_0=8.25*10^(11);
t=L./v;
func_epsilon=@(w) 1-((omega_P.^2)./(w.*(w+1i*gamma_0)));
func_r_P=@(w,k_x,k_y) (func_epsilon(w).*sqrt((w.^2)./(c^2)-sqrt(k_x.^2+k_y.^2).^2)-sqrt((w.^2.*func_epsilon(w))./(c^2)-sqrt(k_x.^2+k_y.^2).^2))./(func_epsilon(w).*sqrt((w.^2)./(c^2)-sqrt(k_x.^2+k_y.^2).^2)+sqrt((w.^2.*func_epsilon(w))./(c^2)-sqrt(k_x.^2+k_y.^2).^2));
func_r_S=@(w,k_x,k_y) (sqrt((w.^2)./(c^2)-sqrt(k_x.^2+k_y.^2).^2)-sqrt((w.^2.*func_epsilon(w))./(c^2)-sqrt(k_x.^2+k_y.^2).^2))./(sqrt((w.^2)./(c^2)-sqrt(k_x.^2+k_y.^2).^2)+sqrt((w.^2.*func_epsilon(w))./(c^2)-sqrt(k_x.^2+k_y.^2).^2));
z = (0:10^(-9):30*10^(-6));
f_1=@(k_x,k_y) (1-cos(k_x.*delta)).*(2*k_B*T)./(hbar.*abs(k_y.*v));
f_3=@(k_x,k_y) imag(func_r_P(abs(k_y.*v),k_x,k_y).*(1-(v.^2.*k_y.^2)./(c.^2.*(k_x.^2+k_y.^2)))+func_r_S(abs(k_y.*v),k_x,k_y).*(v.^2./c.^2).*(k_x.^2)./(k_x.^2+k_y.^2));
for ii=1:length(z)
f_2=@(k_x,k_y) (exp(-2.*sqrt(k_x.^2+k_y.^2).*z(ii).*sqrt(1-(v.^2.*k_y.^2)./(c.^2.*(k_x.^2+k_y.^2)))))./(2.*sqrt(k_x.^2+k_y.^2).*sqrt(1-(v.^2.*k_y.^2)./(c.^2.*(k_x.^2+k_y.^2))));
func_u=@(k_x,k_y) f_1(k_x,k_y).*f_2(k_x,k_y).*f_3(k_x,k_y);
gamma=-((t.*e^2)./(epsilon_0*hbar*4*pi*pi)).*integral2(@(k_x,k_y)func_u(k_x,k_y),-inf,inf,-inf,inf);
gamma_save(ii)=gamma;
end
y = exp(gamma_save);
plot(z,y);
ylim([0 1.1]);
title('test');
xlabel('z [m]');
ylabel('K');
%matlab2tikz('standalone',true,'externalData',true);
我做错了什么?有趣的是,我的结果因例如-1e9,1e9或-1e8,1e8。但是,对于有限(高)边界,结果仍然是错误的。变量z的步长是决定性的吗? MatLab适合这个问题吗?提前谢谢!