Function of two variable for specific values of Z?

1 回表示 (過去 30 日間)
amine&&
amine&& 2016 年 7 月 5 日
コメント済み: amine&& 2016 年 7 月 6 日
I want to draw my function of two variable so that the graph gives me Z values between -5 and 5. I used this code but it gives me the values of Z from 0 :
[X,Y] = meshgrid(0:.2:1, 0:.2:1);
Z = arrayfun(@mFunction, X, Y);
surf(X,Y,Z)
How I should proceed. Thanks!
  2 件のコメント
Star Strider
Star Strider 2016 年 7 月 6 日
Without knowing what ‘mFunction’ is, no Answer to your Question is possible.
Stephen23
Stephen23 2016 年 7 月 6 日

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

回答 (1 件)

James Tursa
James Tursa 2016 年 7 月 5 日
Maybe define X and Y before you use them?
[X,Y] = meshgrid(0:.2:1, 0:.2:1);
Z = arrayfun(@mFunction, X, Y);
surf(X,Y,Z)
  7 件のコメント
James Tursa
James Tursa 2016 年 7 月 6 日
Ah ... confusion in the wording. I (and probably other readers) assumed by these words " ...Z values between -5 and 5 ..." that you were actually talking about the Z values being plotted, not the Z axis limits.
amine&&
amine&& 2016 年 7 月 6 日
You are right James!

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by