plotting 3d graph

6 ビュー (過去 30 日間)
priya
priya 2021 年 7 月 5 日
コメント済み: priya 2021 年 7 月 5 日
I have a surface, with a function Z plotted as a function of two variables X and Y. The code is:
x = -100:25:100 ;
y = 600:120:1500 ;
[X, Y] = meshgrid(x, y);
Z = 3 *X + 2 ./(Y);
surf(X, Y, Z);
I want to plot the minimum of function Z plotted on the x-axis, for every value of Y.
Something like this (the red line and green marks).
Please help.
I want to plot this:
for y =600, the minimum value of z is -300 at x= -100; plot (x=-100, z=-300)
then for y = 720, the minimum value of z is -300 at x= -100; plot (x=-100, z=-300)
and so on.
Pleas help.

採用された回答

Amit Bhowmick
Amit Bhowmick 2021 年 7 月 5 日
x = -100:25:100 ;
y = 600:120:1500 ;
[X, Y] = meshgrid(x, y);
Z = 3 *X + 2 ./(Y);
surf(X, Y, Z);
fminx=min(abs(Z),[],1)
fminy=min(abs(Z),[],2)
hold;
plot3(zeros(size(y)),y,fminy','ro')
  3 件のコメント
Amit Bhowmick
Amit Bhowmick 2021 年 7 月 5 日
[fminx,idx]=min(Z,[],1)
[fminy,idy]=min(Z,[],2)
hold;
plot3(X(:,idy),Y(:,idy),fminy,'ro')
priya
priya 2021 年 7 月 5 日
Thanks a lot !!

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by