Hi all
I want to compute erfc(.) of a complex number. How can I do that? Is there any way to use erfc(.) of matlab?

 채택된 답변

Matt Fig
Matt Fig 2011년 5월 10일

2 개 추천

A quick search of the FEX turned up these two. There may be others...

댓글 수: 14

Dilip Jose
Dilip Jose 2020년 1월 30일
sir will you pls tel me how to define erfc(.)....in terms of complex number ....im having my rsults interms exponentiam and complementary error function ....dont know how to plot this.....struggling for 3 months PHOTO-2020-01-20-11-34-10.jpg
Dilip Jose
Dilip Jose 2020년 1월 30일
PHOTO-2020-01-20-11-34-10 2.jpg
Dilip Jose
Dilip Jose 2020년 1월 30일
i have tried something but couldn't....pls find the attachemnt
close all
syms z;
gr=5;
gc=5;
M=1;
w=0.5;
pr=7;
sc=2.01;
t=0.4;
m=(M+(2*1i*w));
s1=z;
s2=(2*sqrt(t));
x=((s1)./(s2));
a1=(x*t);
a2=(2*m*(sqrt(pi)));
a=((m)./(pr-1));
b=((m)./(sc-1));
x=((s1)./(s2));
u1=((x^2+(m*t))*t);
u2=4*m;
d1=(x*(sqrt(t)))*(1-(4*m*t));
d2=(8*m^3/2);
v1=gr;
v2=(a*(1-pr));
k1=gc;
k2=(b*(1-sc));
h1=exp(a*t);
h2=2;
e1=(exp(2*x*(sqrt(m*t))));
e2=(erfc(x+(sqrt(m*t))));
e3=(exp(-2*x*(sqrt(m*t))));
e4=(erfc(x-(sqrt(m*t))));
b1=(exp(2*x*((sqrt((m+a)*t)))));
b2=(erfc(x+(sqrt((m+a)*t))));
b3=(exp(-2*x*(sqrt((m+a)*t))));
b4=(erfc(x-(sqrt((m+a)*t))));
b5=(exp(2*x*((sqrt((m+b)*t)))));
b6=(erfc(x+(sqrt((m+b)*t))));
b7=(exp(-2*x*(sqrt((m+b)*t))));
b8=(erfc(x-(sqrt((m+b)*t))));
e5=exp(-(x^2+(m*t)));
c1=(exp(2*x*(sqrt(pr*a*t))));
c2=(erfc(x*(sqrt(pr)+(sqrt(a*t)))));
c3=((exp(-2*x*(sqrt(pr*a*t)))));
c4=(erfc(x*(sqrt(pr)-(sqrt(a*t)))));
l1=(exp(2*x*(sqrt(sc*b*t))));
l2=(erfc(x*(sqrt(sc)+(sqrt(b*t)))));
l3=((exp(-2*x*(sqrt(sc*b*t)))));
l4=(erfc(x*(sqrt(sc)-(sqrt(b*t)))));
f1=(exp(b*t));
f2=2;
l=((a1)./(a2));
f=((f1)./(f2));
h=((h1)./(h2));
j1=((u1)./(u2));
j2=((d1)./(d2));
j3=((v1)./(v2));
j4=((k1)./(k2));
q1=(2*(j1*((e1*e2)+(e3*e4))+(j2*((e3*e4)-(e1*e2))-(l*e5))));
q2=((j3+j4)*(1/2)*((e1*e2)+(e3*e4)));
q3=((j3*(h*(b1*b2)+(b3*b4))));
q4=((j4*(f*(b5*b6)+(b7*b8))));
q5=(j3*(erfc(x*sqrt(pr))));
q6=(j4*erfc(x*sqrt(sc)));
q7=(j3*(h*((c1*c2)+(c3*c4))));
q8=(j4*(f*((l1*l2)+(l3*l4))));
q=(q1+q2-q3-q4-q5-q6+q7+q8);
fplot(z,q);
xlim([0 5])
ylim([0 1])
hold on
title('Axial velocity profiles for different values of gr & gc');
hold off
Walter Roberson
Walter Roberson 2020년 1월 30일
The symbolic toolbox can take erfc of a complex number as long as it is passed in symbolic form. erfc(sym(.3-.2i)) for example.
Dilip Jose
Dilip Jose 2020년 2월 5일
yes sir now im using fadf.m for erfc...but now symbolic variable is exist inside fadf ...error shwing wat to do
Dilip Jose
Dilip Jose 2020년 2월 5일
편집: Dilip Jose 2020년 2월 5일
sir i have installed package.....in that erfc change to fadf.....in fadf(symbolic variable)...what to do....
syms z
dt=0.01;t1=0;t2=5;t=(t1:dt:t2);
u=0.2;
w=0.5;
M=1;
m=((M+(2*1i*w))*u);
k=(fadf(z./(2*(u).^.5)+(M+(2*1i*w))*u).^.5);
re_k=real(k);im_k=imag(k);
plot(re_z,im_k);
Walter Roberson
Walter Roberson 2020년 2월 5일
fadf is not designed for symbolic use.
If you have the symbolic toolbox then it already handles erfc of a complex number as long as the number is passed in symbolic form.
Dilip Jose
Dilip Jose 2020년 2월 5일
yes sir thank you...in my result z is infinite plane ....by defining sym z...i have done my plotting....but in velocity profile equation ...erfc of complex number exist....fadf is used to define erfc of complex...getting error...how to define z infinite plane extent..need a support.
fplot(z,q);
where z is a plain symbolic variable and q is a symbolic expression in z. However, q is complex valued and fplot() cannot plot complex valued things. You can, though, do things like
fplot3(z, real(q), imag(q))
You cannot use fplot to plot over the entire z plane -- for one thing the imaginary component of q goes to about - 9.878*10^6730 by the time z is -1e4 .
fafd needs to be able to test
ind_neg = imag(z)<0; % if some imag(z) values are negative, then ...
z(ind_neg) = conj(z(ind_neg)); % ... bring them to the upper-half plane
FF = zeros(size(z)); % define array
ind_ext = abs(z)>8; % external indices
ind_band = ~ind_ext & imag(z)<5*10^-3; % narrow band indices
It cannot test those things for symbolic z, because z could have any value to be determined later.
To work with fafd, you will need to create specific numeric z and calculate based upon those.
syms z
dt=0.01;t1=0;t2=5;t=(t1:dt:t2);
u=0.2;
w=0.5;
M=1;
m=((M+(2*1i*w))*u);
k=(fadf(z./(2*(u).^.5)+(M+(2*1i*w))*u).^.5);
re_k=real(k);im_k=imag(k);
plot(re_z,im_k);
You do not use t after you create it, so perhaps your z should be set to be t ?
To check, you have
d2=(8*m^3/2);
Is it possible that that should be
d2=(8*m^(3/2));
The current expression would be equivalent to the clearer
d2=4*m^3;
Or even 8/2 instead of 4 if that somehow made documentation sense. With the /2 where it is and with the leading multiplier already even, people are going to wonder.
Dilip Jose
Dilip Jose 2020년 2월 13일
thank you so much sir ...got some results...hope the best.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2011년 5월 10일

댓글:

2020년 2월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by