Hello there,
...hopefully my intentions with the input below is understood. What exact changes should I consider with line 4 or 5? There's always an error issue here. Thanks, I'm new to this.
spacing = 0.2;
[X,Y] = meshgrid(-2:spacing:2);
Z = X.*exp(-X.^2 - Y.^2);
[DX,DY,DZ] = gradient(Z,spacing);
quiver(X,Y,Z,DX,DY,DZ)
hold on
contour3(X,Y,Z)
axis equal
hold off

回答 (1 件)

KSSV
KSSV 2022 年 6 月 19 日

0 投票

spacing = 0.2;
[X,Y] = meshgrid(-2:spacing:2);
Z = X.*exp(-X.^2 - Y.^2);
[DX,DY] = gradient(Z);
quiver(X,Y,DX,DY)
hold on
contour(X,Y,Z)
axis equal
hold off

1 件のコメント

John Omoruyi
John Omoruyi 2022 年 6 月 19 日
...thank u so much for replying.
I'm quite aware of this 2D solution, but actually more interested in the 3D implementation as I initially described. I'd be very greatful if you can help.

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

カテゴリ

ヘルプ センター および File ExchangeVector Fields についてさらに検索

タグ

質問済み:

2022 年 6 月 19 日

コメント済み:

2022 年 6 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by