이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
erfc with complex number
조회 수: 18 (최근 30일)
이전 댓글 표시
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
2011년 5월 10일
댓글 수: 14
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/269054/PHOTO-2020-01-20-11-34-10.jpeg)
![PHOTO-2020-01-20-11-34-10.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/269054/PHOTO-2020-01-20-11-34-10.jpeg)
Dilip Jose
2020년 1월 30일
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
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
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
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
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
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.
Walter Roberson
2020년 2월 5일
In your original code at https://www.mathworks.com/matlabcentral/answers/7153-erfc-with-complex-number#comment_791526 you have
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 .
Walter Roberson
2020년 2월 5일
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 ?
Walter Roberson
2020년 2월 5일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)