フィルターのクリア

controlling the spread of contour lines

7 ビュー (過去 30 日間)
ANOSH PHIROZ AMARIA
ANOSH PHIROZ AMARIA 2018 年 11 月 9 日
編集済み: Image Analyst 2018 年 11 月 9 日
I have the following code which plots a filled contour. I want more closed contours towards the center of the figure because they are more important to me. How can I control the spacing of the contour lines?
% Function to plot contours
x1=-5:0.1:5;
x2=-5:0.1:5;
[a ,b]=meshgrid(x1,x2);
f=(2.*(a).^2)-(1.05.*(a).^4)+((a.^6)./6)+(a.*b)+(b.^2);
[c,h]=contourf(a,b,f,20);
clabel(c,h);

回答 (1 件)

Star Strider
Star Strider 2018 年 11 月 9 日
You can define the contour levels with a vector.
Example
% Function to plot contours
x1=-5:0.1:5;
x2=-5:0.1:5;
[a ,b]=meshgrid(x1,x2);
f=(2.*(a).^2)-(1.05.*(a).^4)+((a.^6)./6)+(a.*b)+(b.^2);
lvls = exp(-10:0.1:7.5); % Define Contour Levels
[c,h]=contourf(a,b,f,lvls);
clabel(c,h);
The ‘lvls’ vector creates an exponentially-increasing set of contours. You can use any vector you want.

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by