40 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
SCIUSCIA am 2 Jun. 2024 um 6:54
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
-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)
Hassaan am 2 Jun. 2024 um 10:06
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;
-----------------------------------------------------------------------------------------------------------------------------------------------------
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
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
@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
@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
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.
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
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Kontakt zu Ihrer lokalen Niederlassung