Plotting two functions on 3D surface for the same interval

Hello
I have two functions, say
Z1=x^2
Z2=x^3
x: 0:10
How i can create a 3D surface plot
thanks in advance

 採用された回答

Star Strider
Star Strider 2020 年 1 月 24 日

0 投票

Try this:
x = 0:10;
Z1=x.^2;
Z2=x.^3;
figure
surf(Z1.'*Z2)
Another possibility:
figure
surf([Z1; Z2])
It is not certain what you want.

4 件のコメント

Star Strider
Star Strider 2020 年 1 月 25 日
編集済み: Star Strider 2020 年 1 月 25 日
Fuad Nammas’s Answers moved here —
many thanks to you dear Star Strider
I need to put
x: on the x-axis
Z1: on the y-axis
Z2: on the z-axis
How I can name the axis
thanks Dear Star Strider
Star Strider
Star Strider 2020 年 1 月 25 日
As always, my pleasure!
Try this:
figure
surf(x, Z1, ones(size(x(:)))*Z2)
xlabel('x')
ylabel('Z1')
zlabel('Z2')
Star Strider
Star Strider 2020 年 1 月 25 日
Fuad Nammas’s Answer moved here —
why is the scale on the x-axis on the plot does not fit the given interval x:0:10
Star Strider
Star Strider 2020 年 1 月 25 日
It should with the code I just posted.

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

その他の回答 (3 件)

Fuad Nammas
Fuad Nammas 2020 年 1 月 25 日

0 投票

sooooo many thanks dear Star Strider
it works now
thanks with appreciation
you are super hero
Fuad Nammas
Fuad Nammas 2020 年 1 月 25 日

0 投票

Dear Star Strider
one last question..
How i can give a different color for each function
i mean
color for Z1 and another color for Z2
i will be greatfull for you
regards

1 件のコメント

Star Strider
Star Strider 2020 年 1 月 25 日
That is not possible as you have defined the plot.
The ‘x’ and ‘Z1’ vectors define the axes, so only ‘Z2’ can have color associated with the surface plot.

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

Fuad Nammas
Fuad Nammas 2020 年 1 月 25 日

0 投票

many thanks Mr.Strider
God Bless you

1 件のコメント

Star Strider
Star Strider 2020 年 1 月 25 日
As always, my pleasure!
Thank you, and you, too.

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

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by