在以下代码中
%%
clc
clear
%%
M=4.5
lambda_0=0.332;
%%
alpha2=0.988;
beta2=-0.05;
omega2=6;
gamma2=sqrt((M^2-1)*alpha2^2-beta2^2);
%%
N=25;
YMAX=150;
eta02=-i*omega2/((i*alpha2*lambda_0)^(2/3));
eta_inf2=((i*alpha2*lambda_0)^(1/3))*YMAX+eta02;
%%
syms lu
aiprime(lu) = airy(1,lu);
aisecond(lu)= diff(airy(1,lu));
airy_D2=airy(1,eta02);
airy_DD2=aisecond(eta02);
airy_INT2=integral(@(n) airy(n),eta02,eta_inf2);
eta2=@(y) ((i*alpha2*lambda_0)^(1/3))*y+eta02;
aa2=2*pi*complex(0,1)*gamma2*beta2*lambda_0*airy_D2/(alpha2*(alpha2^2+beta2^2)*airy_INT2-gamma2*lambda_0*airy_D2*(i*alpha2*lambda_0)^(2/3));
% bb2=-aa2*airy(2,eta02)*airy_INT2/airy(eta02);
Gi2=@(x) -(airy(2,x)*integral(@(n) airy(n),eta_inf2,x)-airy(x)*integral(@(n) airy(2,n),eta02,x));
W2=@(eta) aa2*(Gi2(eta)-Gi2(eta02)/airy(eta02)*airy(eta));
W2VEC=arrayfun(W2,arrayfun(eta2,0:0.01:N));
plot(abs(W2VEC),0:0.01:N)
很明显,根据定义eta=eta02
,aa2*(Gi2(eta02)-Gi2(eta02)/airy(eta02)*airy(eta02))=0
。但是,它不是,我认为这是由于MATLAB使用的精度。什么是最好的,以克服这个问题?