Neglecting certain values taken by the contour

19 views (last 30 days)
I have a contour plot M whose values are ranging from positive to negative. On my output plot,I only want to show the values greater than or equal to 0 value of M
Ro=0.00:0.005:0.3;
Ri=real(((Ro.^4)-(Ro./(1250*pi))).^(0.25));
[a,b]=meshgrid(Ro,Ri);
M=39250.*pi.*((a.*a)-(b.*b));
%Delta=0.00992./b;
[C,h]=contour(a,b,M,30);
clabel(C,h);

Accepted Answer

Star Strider
Star Strider on 17 Sep 2018
I am not certain what you want to do, so I included two options for you to choose from:
Ro=0.00:0.005:0.3;
Ri=real(((Ro.^4)-(Ro./(1250*pi))).^(0.25));
[a,b]=meshgrid(Ro,Ri);
M=39250.*pi.*((a.*a)-(b.*b));
%Delta=0.00992./b;
[C,h]=contour(a,b,M,30);
Lvls = h.LevelList; % <— Add This Line
h.LevelList = Lvls(Lvls >= 0); % Only Plots Levels >= 0
clabel(C,h, Lvls(Lvls >= 0)); % Only Labels Levels >= 0

More Answers (0)

Categories

Find more on Contour 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!