MATLAB: How to plot Error function of complex numbers

error function of complex numbers plotno attempt

Dear sir how have plotted for complex function taking omega=pi/2, M=0.5

Best Answer

Hi Harekrishna Mandal
Although MATLAB standard functions erf and erfc only work with real inputs, there is the MATLAB implementation of erfc(z) z Complex, by S. Abrarov, available here
fadf.m Attached to this answer for convenience.
I reach the following plots for a time interval of [0 10] dt=0.01 and sample theta=1
clear all;close all;clc;
M=.4;w=pi/2;
dt=0.01;t1=0;t2=10;t=[t1:dt:t2];
theta=1; % sample value
p7_1=.25*exp(-1j*w*t)*exp(theta*(M-1j*w)^.5).*fadf((M-1j*w).^.5+.5*theta./(t).^.5);
p7_2=.25*exp(-1j*w*t)*exp(-theta*(M-1j*w)^.5).*fadf(-(M-1j*w).^.5+.5*theta./(t).^.5);
p7_3=.25*exp(1j*w*t)*exp(theta*(M+1j*w)^.5).*fadf((M+1j*w).^.5+.5*theta./(t).^.5);
p7_4=.25*exp(1j*w*t)*exp(-theta*(M+1j*w)^.5).*fadf(-(M+1j*w).^.5+.5*theta./(t).^.5);
p7=p7_1+p7_2+p7_3+p7_4;
abs_p7=abs(p7);arg_p7=angle(p7);
re_p7=real(p7);im_p7=imag(p7);
figure(1);plot(t,abs_p7,t,arg_p7);grid on;legend('|p7|','ang(p7)');
figure(2);plot(t,re_p7,t,im_p7);grid on;legend('re(p7)','im(p7)');
.
.
.
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG