How do I plot a contour map in Matlab?

>> x=-6:0.001:6; >> y=-6:0.001:6; >> [X,Y]=meshgrid(x,y); >> phi=x.*y-y; >> contour(x,y,phi) Error using contour (line 48) Z must be at least a 2x2 matrix.

 採用された回答

madhan ravi
madhan ravi 2018 年 9 月 10 日
編集済み: madhan ravi 2018 年 9 月 10 日

1 投票

EDITED
x=linspace(-6,6,1000);
y=x;
[X,Y]=meshgrid(x,y)
phi=X.*Y-Y
contour(X,Y,phi)

5 件のコメント

madhan ravi
madhan ravi 2018 年 9 月 10 日
If it works please accept the answer.
cstibbards
cstibbards 2018 年 9 月 10 日
Matlab froze when I typed this in, it hasn't worked yet.
madhan ravi
madhan ravi 2018 年 9 月 10 日
編集済み: madhan ravi 2018 年 9 月 10 日
Now try the edited code it worked for me.
madhan ravi
madhan ravi 2018 年 9 月 10 日
did it work @cstibbards?
cstibbards
cstibbards 2018 年 9 月 10 日
Not yet, but I think its an issue with my computer running Matlab, not the code. Thanks.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

タグ

質問済み:

2018 年 9 月 10 日

コメント済み:

2018 年 9 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by