Plot intersection between two surfaces and a plane. (2024)

41 Ansichten (letzte 30 Tage)

Ältere Kommentare anzeigen

SCIUSCIA am 2 Jun. 2024 um 6:54

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2124671-plot-intersection-between-two-surfaces-and-a-plane

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2124671-plot-intersection-between-two-surfaces-and-a-plane

Kommentiert: Hassaan am 2 Jun. 2024 um 14:25

I would like to plot the xy intersection of two surfaces coming from

surf command and a plane from the patch command.

I tried with the contourf, but it seems to be not possible.

Can this be done?

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Antworten (1)

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2124671-plot-intersection-between-two-surfaces-and-a-plane#answer_1466326

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2124671-plot-intersection-between-two-surfaces-and-a-plane#answer_1466326

Bearbeitet: Hassaan am 2 Jun. 2024 um 10:08

In MATLAB Online öffnen

A basic idea [other solutions may also exists]:

Define the surfaces and the plane:

  • Use the surf command to define the two surfaces.
  • Use the patch command to define the plane.

Calculate the intersections:

  • Use the contour3 command to find the intersection contours of each surface with the plane.

Plot the results:

  • Combine the surfaces, plane, and intersection curves in a single plot.

% Define the grid for the surfaces

[X, Y] = meshgrid(linspace(-5, 5, 100));

% Define the first surface

Z1 = X.^2 + Y.^2;

% Define the second surface

Z2 = 10 - (X.^2 + Y.^2);

% Define the plane (for example, z = 5)

Z_plane = 5;

% Plot the first surface

figure;

surf(X, Y, Z1);

hold on;

% Plot the second surface

surf(X, Y, Z2);

% Plot the plane

patch([-5, 5, 5, -5], [-5, -5, 5, 5], [Z_plane, Z_plane, Z_plane, Z_plane], 'g', 'FaceAlpha', 0.5);

% Calculate and plot the intersection curves

contour3(X, Y, Z1, [Z_plane, Z_plane], 'r', 'LineWidth', 2); % Intersection of first surface with the plane

contour3(X, Y, Z2, [Z_plane, Z_plane], 'b', 'LineWidth', 2); % Intersection of second surface with the plane

% Adjust the view

xlabel('X');

ylabel('Y');

zlabel('Z');

title('Intersection of Surfaces and a Plane');

legend('Surface 1', 'Surface 2', 'Plane', 'Intersection Curve 1', 'Intersection Curve 2');

grid on;

hold off;

Plot intersection between two surfaces and a plane. (3)

-----------------------------------------------------------------------------------------------------------------------------------------------------

If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.

It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.

Professional Interests

  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering

Feel free to contact me.

2 Kommentare

Keine anzeigenKeine ausblenden

Matt J am 2 Jun. 2024 um 14:24

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/2124671-plot-intersection-between-two-surfaces-and-a-plane#comment_3177711

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/2124671-plot-intersection-between-two-surfaces-and-a-plane#comment_3177711

@SCIUSCIA If it works perfectly, you should Accept-click it.

Hassaan am 2 Jun. 2024 um 14:25

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/2124671-plot-intersection-between-two-surfaces-and-a-plane#comment_3177716

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/2124671-plot-intersection-between-two-surfaces-and-a-plane#comment_3177716

@SCIUSCIA You are welcome!

-----------------------------------------------------------------------------------------------------------------------------------------------------

If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.

It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.

Professional Interests

  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering

Feel free to contact me.

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Siehe auch

Kategorien

MATLABGraphics2-D and 3-D PlotsSurfaces, Volumes, and PolygonsSurface and Mesh Plots

Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange

Tags

  • plane
  • intersection
  • xyplot
  • double surface

Produkte

  • MATLAB

Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Es ist ein Fehler aufgetreten

Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.


Translated by Plot intersection between two surfaces and a plane. (6)

Plot intersection between two surfaces and a plane. (7)

Website auswählen

Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .

Sie können auch eine Website aus der folgenden Liste auswählen:

Amerika

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europa

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asien-Pazifik

Kontakt zu Ihrer lokalen Niederlassung

Plot intersection between two surfaces and a plane. (2024)
Top Articles
Latest Posts
Article information

Author: Corie Satterfield

Last Updated:

Views: 5734

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Corie Satterfield

Birthday: 1992-08-19

Address: 850 Benjamin Bridge, Dickinsonchester, CO 68572-0542

Phone: +26813599986666

Job: Sales Manager

Hobby: Table tennis, Soapmaking, Flower arranging, amateur radio, Rock climbing, scrapbook, Horseback riding

Introduction: My name is Corie Satterfield, I am a fancy, perfect, spotless, quaint, fantastic, funny, lucky person who loves writing and wants to share my knowledge and understanding with you.