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

8 次查看(过去 30 天)
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.

请先登录,再进行评论。

类别

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