Cross section of a plot (surface, Imagesc) using an arbitrary line
Afficher commentaires plus anciens
I have a plot of surface(x,y,z) (or an imagesc) and want to draw an arbitrary line to get the z information following that path.
So I have two questions:
First, how to draw a path that coincides with my x,y grid? Let's say I want a semicircular path, but it can be whichever.

And second, how do I get the values that correspond to the Z information that follows that said path?
I am not sure if what I am asking is too complex to answer, but I would love to hear your comments,
Thanks in advance.
Réponse acceptée
Plus de réponses (3)
Image Analyst
le 9 Mar 2023
1 vote
That's exactly what my attached demo does. It allows you to draw over your image with drawfreehand and then plots the image values underneath where you drew:

Steven Lord
le 9 Mar 2023
0 votes
Others have spoken about the mathematics behind taking coordinate data of your math and generating the Z data. If you're having difficulty in the first part of the problem, generating the coordinate data, some options include using the ginput function to let you click points on the plot (for which I'd probably use a 2-D view of your surface, view(2), so you're clicking from "directly overhead") or using the improfile function from Image Processing Toolbox (if you're operating on image data or can treat your data as image data.)
Contoso Donoso
le 10 Mar 2023
0 votes
Catégories
En savoir plus sur Surface and Mesh Plots dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
