different plots on different levels of zooming

2 次查看(过去 30 天)
I am running this code on MatLab:
function main
fimplicit (@(x,y)f(x,y),[2 5])
end
function fun = f(x,y)
nc=1.45; %cladding
nf=1.5;
ns=1.4; %substrate
h=5; %width of waveguide
kappa=sqrt(x^2*nf^2-y.^2);
gammas=sqrt(y^2-x^2*ns^2);
gammac=sqrt(y^2-x^2*nc^2);
z=sin(h.*kappa);
%TE mode
fun=z.*(kappa.^2-gammas.*gammac)-cos(h.*kappa).*(gammac+gammas).*kappa;
end
I got: (notice the wavy top line and dotted lower line)
Then I zoomed in around (2.5,3.5): (Notice the waves disappears)
Again I zoomed out and in again: (notice only staright lines remain):
1) Why am I getting such erratic behaviour.
2) What can be done to correct this since I need graphs for college work and cant use these.
Thanks !

回答(1 个)

Kavya Vuriti
Kavya Vuriti 2020-3-31
Hi,
While using fimplicit function, the plot depends on the number of evaluation points per direction. This property is termed as 'MeshDensity' with 151 as default value. Changing this value can give you the desired plot. This can be set either by using property inspector or can be given as a 'Name-Value' pair to fimplicit function.
The graphics issue with zoom may be due to older graphics hardware or outdated graphics drivers. By default MATLAB graphics uses hardware accelerated implementation. This may cause issues when graphic drivers are outdated. This issues can be resolved by updating graphics drivers or by changing to software implementation by using following command:
>> opengl('save', 'software');
Restart MATLAB and check if the implementation is changed by using the following command:
>> opengl info
For more information, you can refer following links:
Hope this helps!!

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by