26
2 Error Functions and Fresnel Integrals
2.2.2 erfComp and Applications
The Class erfComp
MATLAB comes with the functions erf and erfc for the error and complementary
error function. Both are restricted to real numbers. The SPECFUNPHYS class [obj,
erg] = erfComp(z,lu,nm) evaluates the error function or complementary
error function in the complex plane. “z” could be an arbitrary complex array. All
other variables are optional. “lu” has the values of “erf” (default, error function) or
“erfc” for computing the complementary error function. The computation is based
on the corresponding incomplete gamma function. Thus, see Chap. 1.5 for details,
“nm” (optional) is the upper bound of summations for series based computations.
The default value depends on |z| to avoid overflow with a maximum number of 500.
The default depth is 10 for the continued fraction (10th-approximant). The object
“obj” comes with the properties, value (function value), info (information about
computational method used and if the error or complementary error function was
computed), and inz (numerical input z), and “erg” is the computational value in
doubles.
erfComp supports the following methods: “abs” for computing the absolute
value, “real” for the real and “imag” for the imaginary value, “angle” for the phase
angle in radians, and “conj” for the complex conjugate value. Each of the methods
can be applied either on the results (value, default) or on the input variables z (inz).
As an example, Fig. 2.1 was created by
x = linspace(-3,3,50);
% Input Data
[X,Y] = meshgrid(x,x);
Z = X+i * Y;
obj = erfComp(Z);
% error function
%
a = 20.5; e = 37.2;
% azimuth and elevation: surf
%
Cz = obj.abs;
% absolute value
%
figure
% visualization
subplot(1,2,1)
surf(X,Y,Cz), view(a,e), xlabel(’real’), ylabel(’imag’)
subplot(1,2,2)
surf(X,Y,Cz,X. * Y),zlim([0,5]), view(a,e)
xlabel(’real’), ylabel(’imag’)
Précédent

- 41/287

Suivant