controlling the spread of contour lines
7 ビュー (過去 30 日間)
古いコメントを表示
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);
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Contour Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!