Surface 'interpolation' along a specific contour

11 次查看(过去 30 天)
Hi, I am really new to MatLab so apologies if this is an exceedingly stupid question or the answer is glaringly obvious...
I have a large amount of data in the following structure:
A rho RMSE
500 0.10 NaN
500 0.11 NaN
500 0.12 12.34
...
500 0.50 56.78
600 0.10 9.01
...
3000 0.50 NaN
I need to plot the surface to see how the RMSE value changes with the value of A and rho. I then need to interpolate the surface order to obtain all the A,rho pairs that give an RMSE value of zero (i.e.interpolate along the zero contour).
I understand that surface plotting requires the data to form a grid: I therefore follow this to restructure my data (as it is in the same format) and can thus use surf() to plot the surface.
My question is thus: How do I display the Z(RMSE) = 0 contour on top of the plotted surface?
How do I 'interpolate' the surface such that I produce a list of x,y combinations that give z=0?
Any pointers in the right direction would be gratefully received.
Many thanks

采纳的回答

Kelly Kearney
Kelly Kearney 2014-9-17
I would let contour do most of the work:
[x,y,z] = peaks(20); % some example data, replace with yours
surf(x,y,z);
shading flat;
hold on;
[c, hc] = contour(x,y,z,[0 0],'k'); % Plot the 0 contour
S = contourcs(x(1,:),y(:,1),z,[0 0]); % same points as c, but clearer
The contourcs function is from the File Exchange; it's a nice wrapper around contourc that reformats the data to be more usable.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by