Error using symengine. Unable to convert expression into double array.
3 views (last 30 days)
Show older comments
Dear all,
I am going to compute the equation (34), and I write the following program. For equation (32)-(34), the variables are w and t, other parameters are all constants. It appears that when ii=8, I met the following problem. Can anyone hlep me with this? Thanks a lot!
t=0:0.01:4;
%Gaussian signal parameters
u=2;
sigma=0.5;
%Other parameters
x=100*10^(-6);
v=0.5*10^(-3);
D_0=10^(-8);
h=10*10^(-6);
width=20*10^(-6);
D=(1+(8.5*(2*v*h*width)^2)/(210*((D_0)^2)*(h^2+2.4*h*width+width^2)))*D_0;
C_T=0.5;
C_I0=3;
C_I=zeros(1,length(t));
t1=0;
gaussian=C_I0*(1/sqrt(2*pi*sigma^2))*exp(((t-u).^2)/(-2*sigma^2));
syms y w;
f1=(1/(sqrt(2*pi)))*exp((y^2)/(-2));
Q1=int(f1,y,((sigma^2*i*w-u)/(sigma)),Inf);
C_I_s=(C_I0*(exp(-i*w*u))*exp((sigma*w)^2/(-2))*(Q1))*exp(x*(v-sqrt(v^2+4*D*(i*w)))/(2*D));
for ii=1:length(t)
f4=((exp(-i*w*t(ii))*conj(C_I_s)+exp(i*w*t(ii))*C_I_s)/(2*pi));
C_I(ii)=double(vpaintegral(f4, w, 0, Inf));
end
0 Comments
Accepted Answer
Walter Roberson
on 17 May 2019
The integral is not convergent enough within the default tolerances.
>> vpaintegral(f4,w,0,inf,'abstol',1e-10,'reltol',1e-50)
ans =
0.000059052224665837442637719156342351353066905377876137 + 3.2017170202144203077006041926988095571201561755465e-65i
However, decreasing abstol does not work -- reltol even to 1e-308 is not enough digits for it to converge at 1E-11.
More Answers (0)
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!