Plotting level sets of a function on a triangulated surface.
Ältere Kommentare anzeigen
I want to plot the level sets of one function g(x,y,z) as curves on an isosurface f(x,y,z)=c. The following code comes close, but I need help getting over the finish line.
[x,y,z] = meshgrid(-1:.025:1);
f = x.^2 +y.^2 + z.^2;
g = x.^2 - y.^2;
c = 0.8
[faces,verts,colors] = isosurface(x,y,z,f,c,g);
patch('Vertices',verts,'Faces',faces,'FaceVertexCData',colors,...
'FaceColor','interp','EdgeColor','none')
view(3)
axis equal
colormap(turbo(10))

In this example code, we can see the level sets as the boundaries between the colored regions, but what I really want is
- Curves on a solid-colored sphere
- The ability to choose which values of g(x,y,z) get plotted
- The ability to choose line styles, colors, and thicknesses
1 Kommentar
Roy Goodman
am 3 Jul. 2025
Bearbeitet: Roy Goodman
am 13 Jan. 2026
Akzeptierte Antwort
Weitere Antworten (1)
Kategorien
Mehr zu Lighting, Transparency, and Shading finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


