Why does disappear my plot when i zoom in in the interest zone?

조회 수: 8 (최근 30일)
Pablo Faus Llopis
Pablo Faus Llopis 2022년 12월 4일
댓글: Pablo Faus Llopis 2022년 12월 7일
This is my code
% CONSTANTS
mu=4*pi*10^-7;
c=3E8;
d=6E-6;
n1=1.45125;
n0=1.44725;
n12=n1^2;
n02=n0^2;
n=(n0/n1)^2;
p=2*pi/c;
NA=sqrt((n1^2)-(n0^2));
% DEFINITION OF MY FUNCTION
beta1= @(k,b) (1/c)*((b)+((k.*n02*(n12-b.^2)*sec(k.*sqrt(n12-b.^2))^2)/(((b.*tan(k.*sqrt(n12-b.^2)))/(sqrt(n12-b.^2)))-(k.*b.*sec(k.*sqrt(n12-b.^2))^2)-((b.*n12)/(sqrt(b.^2-n02))))));
% REPRESENTATION
fimplicit(beta1, [0 20*pi 0 500])
when i zoom in the interest zone (x (0,10),y(0,10), the plot disappears, why does this happen?

답변 (1개)

Walter Roberson
Walter Roberson 2022년 12월 4일
편집: Walter Roberson 2022년 12월 4일
Your code assumes that there are continuous solutions for at least a subrange of [0 20*pi]
% CONSTANTS
mu=4*pi*10^-7;
c=3E8;
d=6E-6;
n1=1.45125;
n0=1.44725;
n12=n1^2;
n02=n0^2;
n=(n0/n1)^2;
p=2*pi/c;
NA=sqrt((n1^2)-(n0^2));
% DEFINITION OF MY FUNCTION
syms b k
beta1 = matlabFunction( (1/c)*((b)+((k.*n02*(n12-b.^2)*sec(k.*sqrt(n12-b.^2))^2)/(((b.*tan(k.*sqrt(n12-b.^2)))/(sqrt(n12-b.^2)))-(k.*b.*sec(k.*sqrt(n12-b.^2))^2)-((b.*n12)/(sqrt(b.^2-n02)))))), 'vars', [k,b])
beta1 = function_handle with value:
@(k,b)b.*3.333333333333333e-9+(k.*1.0./cos(k.*sqrt(-b.^2+2.1061265625)).^2.*(b.^2-2.1061265625).*6.981775208333333e-9)./(b.*1.0./sqrt(b.^2-2.0945325625).*2.1061265625+b.*k.*1.0./cos(k.*sqrt(-b.^2+2.1061265625)).^2-b.*tan(k.*sqrt(-b.^2+2.1061265625)).*1.0./sqrt(-b.^2+2.1061265625))
Kvals = linspace(0, 6, 500).';
Bs = arrayfun(@(k) vpasolve(beta1(k,b),b), Kvals);
plot(Kvals, [real(Bs), imag(Bs)]); yline(0);
legend({'real', 'imaginary'})
For the range up to 6, the only solutions are roughly 10 individual points where the imaginary part of the vpasolve() are 0. Not a continuous line, just individual points
Kvals2 = linspace(6, 50*pi, 250).';
Bs2 = arrayfun(@(k) vpasolve(beta1(k,b),b), Kvals2);
plot(Kvals2, [real(Bs2), imag(Bs2)]); yline(0);
legend({'real', 'imaginary'})
Above 6 there appear to be a number of individual-point solutions.
  댓글 수: 2
Walter Roberson
Walter Roberson 2022년 12월 4일
One can make the hypothesis that each solution should be "close to" the previous one.
% CONSTANTS
mu=4*pi*10^-7;
c=3E8;
d=6E-6;
n1=1.45125;
n0=1.44725;
n12=n1^2;
n02=n0^2;
n=(n0/n1)^2;
p=2*pi/c;
NA=sqrt((n1^2)-(n0^2));
% DEFINITION OF MY FUNCTION
syms b k
beta1 = matlabFunction( (1/c)*((b)+((k.*n02*(n12-b.^2)*sec(k.*sqrt(n12-b.^2))^2)/(((b.*tan(k.*sqrt(n12-b.^2)))/(sqrt(n12-b.^2)))-(k.*b.*sec(k.*sqrt(n12-b.^2))^2)-((b.*n12)/(sqrt(b.^2-n02)))))), 'vars', [k,b])
beta1 = function_handle with value:
@(k,b)b.*3.333333333333333e-9+(k.*1.0./cos(k.*sqrt(-b.^2+2.1061265625)).^2.*(b.^2-2.1061265625).*6.981775208333333e-9)./(b.*1.0./sqrt(b.^2-2.0945325625).*2.1061265625+b.*k.*1.0./cos(k.*sqrt(-b.^2+2.1061265625)).^2-b.*tan(k.*sqrt(-b.^2+2.1061265625)).*1.0./sqrt(-b.^2+2.1061265625))
Kvals = linspace(0, 6, 500).';
Kvals(1) = []; %0 is a special case
N = length(Kvals);
Bs = zeros(N,1);
guess = 1+1i;
for idx = 1 : N
sol = vpasolve(beta1(Kvals(idx), b), guess);
if isempty(sol)
Bs(idx) = nan;
else
Bs(idx) = sol;
guess = sol;
end
end
plot(Kvals, [real(Bs), imag(Bs)]); yline(0);
legend({'real', 'imaginary'})
The solutions for the fimplicit are the locations where the orange-ish line crosses 0 -- only two points in this range.
Why is the previous plot so messy then? Well that means there are multiple point-wise solutions, and that should perhaps be investigated more -- but even so, the solutions are still point-wise, not continuous curves.
Pablo Faus Llopis
Pablo Faus Llopis 2022년 12월 7일
okay now i undersand! thanks a lot!

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

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by