Complex implicit function 2D plot

조회 수: 3 (최근 30일)
Jiacong Sun
Jiacong Sun 2020년 3월 26일
댓글: Jiacong Sun 2020년 4월 6일
I am trying to plot a implicit function of the form
H2 = 100;
n2 = 2.0;
n1 = 1.47;
rho = 0;
m = 1;
fun = @(x,y) sqrt((2.*pi/x)^2.*n2^2-y^2).*H2-2.*atan( ((n2/n1)^(2.*rho)).*sqrt((y^2-n1^2.*(2.*pi/x)^2)/(n2^2.*(2.*pi/x)^2-y^2)) )-m.*pi;
I already tried
ezplot(fun, [300, 700, 0, 1]);
But it shows no plot and there is a warning
Warning: Function failed to evaluate on array inputs; vectorizing the function may speed up its
evaluation and avoid the need to loop over array elements.
Any help?
Thanks
  댓글 수: 8
Walter Roberson
Walter Roberson 2020년 3월 29일
fun = @(x,y) sqrt((2.*pi./x).^2.*n2.^2-y.^2).*H2-2.*atan( ((n2./n1).^(2.*rho)).*sqrt((y.^2-n1.^2.*(2.*pi./x).^2)./(n2.^2.*(2.*pi./x).^2-y.^2)) )-m.*pi;
fsurf(fun,[300,700,0,0.045]);
The surface is mostly complex-valued. The imaginary portion is 0 for some Y values between about 0.0132 and 0.045. If you do not constrain the plot, you will see almost nothing.
Jiacong Sun
Jiacong Sun 2020년 4월 6일
It seems 'fsurf' is a good way to check the function. I will set some constrain to it. Thank you a lot.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by