フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

who can create a surf y=0 in a defined domain?

1 回表示 (過去 30 日間)
Moein
Moein 2014 年 10 月 3 日
コメント済み: Stephen23 2014 年 10 月 3 日
hi friends
i want to create a surf y=0 in a domain by surf and linspace functions with this code:
hsp = surf(linspace(-0.3,1.3,200),zeros(200)+0.125,linspace(-0.251776695,0.501776695,200));
but it errors.
for the case z=0 the following code is correct:
hsp = surf(linspace(-0.3,1.3,200),linspace(-0.251776695,0.501776695,200),zeros(200)+0.125);
but for y=0 it errors:
Z must be a matrix, not a scalar or vector.
help me if you can.
thanks a lot
  2 件のコメント
John D'Errico
John D'Errico 2014 年 10 月 3 日
Don't just keep on asking the same question!
Stephen23
Stephen23 2014 年 10 月 3 日
Please stop double posting (or in your case, triple posting).
If you wish to make people aware of your question, you only need to add a comment to the original question and it come to the front of the list.
Imagine other readers here: we don't know what advice you already have become on the other posts of the same question, and we are not paid to find all three posts of your identical question, compare the current best answers and see if we can add anything better.

採用された回答

Mike Garrity
Mike Garrity 2014 年 10 月 3 日
The 3rd arg to surf needs to be 2D. That's optional for the other two. You can use meshgrid to expand your 1D arrays out to 2D like this:
[x,z]=meshgrid(linspace(-0.3,1.3,200),linspace(-0.251776695,0.501776695,200));
surf(x,zeros(200)+.125,z)

その他の回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by