Plotting level sets of a function on a triangulated surface.
Mostrar comentarios más antiguos
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 comentario
Roy Goodman
el 3 de Jul. de 2025
Editada: Roy Goodman
el 13 de En. de 2026
Respuesta aceptada
Más respuestas (1)
Categorías
Más información sobre Lighting, Transparency, and Shading en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


