plotting functions over domain

16 ビュー (過去 30 日間)
lateef
lateef 2023 年 3 月 23 日
編集済み: the cyclist 2023 年 3 月 23 日
how would i go about doing this im constanly getting erros with my current code
Plot the function f (x, y) = (x^2 + 3y^2)e^1x^2-y^2
over the domain 1 x 1, 1 y 1.

採用された回答

Matt J
Matt J 2023 年 3 月 23 日
fsurf(@(x,y) (x.^2 + 3*y.^2).*exp(1 - x.^2 - y.^2), [-1,1],ShowContours='on');

その他の回答 (1 件)

the cyclist
the cyclist 2023 年 3 月 23 日
f = @(x,y) (x.^2 + 3*y.^2).*exp(1 - x.^2 - y.^2); % I'm not certain about your notation here
x = -1 : 0.05 : 1;
y = -1 : 0.05 : 1;
[xx,yy] = meshgrid(x,y);
figure
surf(xx,yy,f(xx,yy))
  2 件のコメント
lateef
lateef 2023 年 3 月 23 日
that code worked thanks if i was to add level curves how would i do that ? would i use the contour command or the meshgrid that used in the example ?
in a single graph, plot some level curves. (A good choice of levels might be c = 0, 0.5, 1, ..., 3.)
the cyclist
the cyclist 2023 年 3 月 23 日
編集済み: the cyclist 2023 年 3 月 23 日
Just realizing I did your homework for you

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by