I want to know how to plot the intersection of a 3D picture with a plane.

3 ビュー (過去 30 日間)
seth wade
seth wade 2019 年 5 月 19 日
コメント済み: Star Strider 2019 年 5 月 19 日
I want to know how to plot the intersection of a 3D picture with a plane.
For example, my matlab code is
x=-10:0.1:10;
y=x;
[x,y]=meshgrid(x,y);
z=1-5*x.^2+3*y.^2+7*x.*y+4*x-9*y;
mesh(x,y)
I want to look at the intersecting line with z=c or z=ax+by(c,a,b are constant)
what matlab code can implement?

採用された回答

Star Strider
Star Strider 2019 年 5 月 19 日
I am not certain what you want.
Try these:
x=-10:0.1:10;
y=x;
[x,y]=meshgrid(x,y);
z=1-5*x.^2+3*y.^2+7*x.*y+4*x-9*y;
figure
c = 1;
mesh(x,y,z)
hold on
contour3(x,y,z, [c,c], 'LineWidth',2, 'Color','k') % One Contour Level At ‘c’
hold off
figure
c = 20*x+15*y;
mesh(x,y,z)
hold on
plot3(x,y,c, 'LineWidth',2, 'Color','g') % Plane Defined By ‘c’
hold off
I want to know how to plot the intersection of a 3D picture with a plane - 2019 05 18.png
Experiment to get different results.
  4 件のコメント
seth wade
seth wade 2019 年 5 月 19 日
And i have a question, what's the meaning of [c,c] in counter3
Star Strider
Star Strider 2019 年 5 月 19 日
That defines one level of the contour. See Contours at One Level (link) for details.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by