How to plot Error function of complex numbers
27 views (last 30 days)
Show older comments
Dear sir how have plotted for complex function taking omega=pi/2, M=0.5
Accepted Answer
John BG
on 24 Aug 2017
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
5 Comments
Dilip Jose
on 5 Feb 2020
sir ...for my problem symbolic variables exist in fadf....error..while compiling....
Example:-how plot this ...pls help me out
% velocity profile code
syms z
dt=0.01;t1=0;t2=5;t=(t1:dt:t2);
u=0.2;
s1=z;
w=0.5;
M=1;
m=((M+(2*1i*w))*u);
k=(fadf(z./(2*(t).^.5)+(M+(2*1i*w))*u).^.5);
re_k=real(k);im_k=imag(k);
plot(t,re_k,t,im_k)
More Answers (1)
Walter Roberson
on 24 Aug 2017
The Symbolic Toolbox is happy to take erfc() of a complex number. After that it is just a matter of putting together the formulas, and deciding which representation one wishes to use for complex plots.
One plot method not mentioned in the link I posted first, is to draw in 3D, putting t on the x axis, real() of the expression on the y axis, and imag() of the expression on the z axis.
0 Comments
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!