Error using erf. Input must be real and full.
2 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. Considering I cannot perform conjugate operation for function handle, I first use the symbolic expression before finally calculate the integral. However, the program shows the error: Error using erf. Input must be real and full. I also used other intergral commands, like the quad, but the same error shows. Can anyone help me with this? Thanks a lot!
%Gaussian signal parameters
u=2;
sigma=0.5;
%Other parameters
t=0:0.01:6;
x=520*10^(-6);
D_0=10^(-8);
v=2*10^(-3);
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;
k=400;
c=0.5;
C_I0=3;
C_I=zeros(1,length(t));
syms y w;
f1=(1/(sqrt(2*pi)))*exp((y.^2)/(-2)); %Q function
Q=int(f1,y,((i*sigma^2*w-u)/(sigma)),Inf); %the integral of Q function
C_A=(exp(-i*w*u))*exp((sigma*w)^2/(-2))*Q*exp(x*(v-sqrt(v^2+4*D*(i*w+k*c)))/(2*D)); %C_A according to equation (33)
for ii=1:length(t)
f4=matlabFunction((exp(-i*w*t(ii))*conj(C_A)+exp(i*w*t(ii))*C_A)/(2*pi)); %convert symbolic expression to function handle
C_I(ii)=C_I0*quadgk(f4,0,Inf); %the integral according to equation (34) for a specific time t
end
0 Comments
Accepted Answer
Walter Roberson
on 18 Feb 2019
for ii=1:length(t)
f4 = ((exp(-i*w*t(ii))*conj(C_A)+exp(i*w*t(ii))*C_A)/(2*pi));
C_I(ii) = C_I0 * double( vpaintegral(f4, w, 0, Inf) ); %the integral according to equation (34) for a specific time t
end
More Answers (0)
See Also
Categories
Find more on Calculus 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!