Ellipsoids rotation or plot in order to intersect at the top
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello to all,
Here is my problem: I need to plot three ellipsoids in 3D in such way that one end of each ellipsoid is placed on the x, y, z axis and the other three ends intersect in order to show me the region of intersection.
So far all of my attempts have ended in failure: i have tried rotating the ellipsoids with no results. I ave tried to modify the centers with no results. I am using the ellipsoid function to generate the x, y, z, matrix and the surf function to plot them.
Best regards, Jean
0 Kommentare
Antworten (1)
nick
am 14 Apr. 2025
Hello Jean,
Kindly clarify whether no result implies there is a mismatch between expected ouptut and obtained output or the figure is empty.
You can utlise 'FaceAlpha' property in 'surf' function to make the ellipsoids semi-transparent, allowing you to visualize the intersection region, as shown:
a = 2;
b = 1;
c = 1;
[x1, y1, z1] = ellipsoid(a, 0, 0, a, b, c, 30); % Centered on x-axis
[x2, y2, z2] = ellipsoid(0, b, 0, a, b, c, 30); % Centered on y-axis
[x3, y3, z3] = ellipsoid(0, 0, c, a, b, c, 30); % Centered on z-axis
figure;
hold on;
% Ellipsoid along x-axis
surf(x1, y1, z1, 'FaceAlpha', 0.2, 'EdgeColor', 'none', 'FaceColor', 'r');
% Ellipsoid along y-axis
surf(x2, y2, z2, 'FaceAlpha', 0.2, 'EdgeColor', 'none', 'FaceColor', 'g');
% Ellipsoid along z-axis
surf(x3, y3, z3, 'FaceAlpha', 0.2, 'EdgeColor', 'none', 'FaceColor', 'b');
axis equal;
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Z-axis');
title('Intersecting Ellipsoids');
grid on;
view(3);
hold off;
You can refer to the documentation by executing the following command in MATLAB Command Window to know more about properties in 'surf' function :
doc surf
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!