different plots on different levels of zooming

1 view (last 30 days)
I am running this code on MatLab:
function main
fimplicit (@(x,y)f(x,y),[2 5])
function fun = f(x,y)
nc=1.45; %cladding
ns=1.4; %substrate
h=5; %width of waveguide
%TE mode
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 !

Answers (1)

Kavya Vuriti
Kavya Vuriti on 31 Mar 2020
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!!


Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by