Extracting contourf data from superimposed line
Ältere Kommentare anzeigen
Hello,
I have a contourf plot with a line superimposed on the plot. I'd like to extract the values of the contour for each coordinate point of the superimposed line, much like the Data Cursor tool in the figure window. The only way I can think to do this is to interpolate between points of the line with the spatial contour coordinates, but this isn't a very accurate solution since my spatial grid isn't extremely fine (to create the grid I have to perform some numerical integration and it takes a long time, also I'm not entirely sure how to do this solution). Can anyone think of a better way to do this?
Thanks for any help, Patrick
8 Kommentare
KSSV
am 30 Sep. 2016
Can you attach an image..so that we can get some idea..
Patrick Comiskey
am 30 Sep. 2016
Star Strider
am 30 Sep. 2016
You can get the contour information as (x,y) pairs for each contour if you request outputs from the contour function.
Read the documentation for contour before you do this!
The format of the output is easy enough to understand, but finding the values you want within the matrix it returns can be an interesting challenge. This usually requires some experimentation.
Patrick Comiskey
am 30 Sep. 2016
Bearbeitet: Patrick Comiskey
am 30 Sep. 2016
Star Strider
am 1 Okt. 2016
You’re doing essentially what I would do. (Individual programming styles differ.) You probably need to find the appropriate ‘ends’ of the contours to plot your green line (or the data needed to do it). This will be either the maximum or the minimum of the x-values with associated y-values less than 0.2. The ismember, or preferably ismembertol, functions might be useful for that.
Patrick Comiskey
am 2 Okt. 2016
Star Strider
am 2 Okt. 2016
My pleasure.
I’m glad you got it sorted.
Rizwan Chughtai
am 6 Feb. 2018
Antworten (0)
Kategorien
Mehr zu Contour Plots finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

