Surface 'interpolation' along a specific contour

조회 수: 11 (최근 30일)
Rebecca
Rebecca 2014년 9월 11일
답변: Kelly Kearney 2014년 9월 17일
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