フィルターのクリア

Plotting Level Curves after function

7 ビュー (過去 30 日間)
lateef
lateef 2023 年 3 月 24 日
コメント済み: Star Strider 2023 年 3 月 25 日
how do i plot level curves in matlab
such as c = 0, 0.5, 1, ..., 3.
i have already computed the code for the function
f (x, y) = (x2 + 3y2)e1x2 y2
over the domain 1 x 1, 1 y 1.

回答 (1 件)

Star Strider
Star Strider 2023 年 3 月 24 日
Use the contour function.
You can use fcontour, however it will not be possible to export its results to plot with contour.
  5 件のコメント
lateef
lateef 2023 年 3 月 25 日
ive attached my currrent code i want to add level curves too using fcountour the code gets an error message
Star Strider
Star Strider 2023 年 3 月 25 日
If you want to use a function handle, my code changes to:
f = @(x,y) (x.^2 + 3*y.^2).*exp(1-x.^2-y.^2);
figure
fcontour(f, [-1 1 -1 1], 'LevelList',[0:0.5:3], 'Fill','on')
colormap(turbo)
colorbar
axis('equal')
That is the only change necessary. The 'Fill','on' is optional.
Your code would work with contour or contourf, although not with fcontour, since fcontour creates its own matrices and does not take them as arguments.
.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by