Slice a surf plot at certain x and y valus

I have as set of f(x,y) data which I inperpoled useing scatteredInterpolant. Then I've displayed the data useing meshgrid and surf.
Now I would like to cut trough that surface at certain x any y values. I do not have volumetric data so I can not use slice or contourslice.
I would like do recive a contour of the surface at a given x or y value.
Does anyone have an idea?
Thank you
F = scatteredInterpolant(x,y,z);
dimx=(max(x)-min(x))/30;
dimy=(max(y)-min(y))/30;
xw = min(x):dimx:max(x);
yw = min(y):dimy:max(y);
[xq,yq] = meshgrid(xw,yw);
zq = F(xq,yq);
surf(xq,yq,zq);

Réponses (2)

Star Strider
Star Strider le 8 Mai 2014

1 vote

If you only want to view the plot between certain x and y values, the axis function might do what you want. You can set the x and y axis limits to whatever interval you want. They will be the same whether you use surf, surfc, contour, or any of the others.
If you want to extract the data from x and z for a particular value of y, or y and z for a particular value of x, that is simply the way you would extract row or column data from any matrix.

1 commentaire

Star Strider
Star Strider le 22 Mai 2014
‘thank you for your answer.
The axis function is not what i look for because i want to desplay the cuts in 2d and extracting rows or columns does not work eather beacouse ther are just a certain number of columns and the rest is interpolated. i want to be able to cut at any x and y value.
any suggestions?’_
See if the slice function will do what you want.

Connectez-vous pour commenter.

Martin
Martin le 22 Mai 2014

0 votes

thank you for your answer.
The axis function is not what i look for because i want to desplay the cuts in 2d and extracting rows or columns does not work eather beacouse ther are just a certain number of columns and the rest is interpolated. i want to be able to cut at any x and y value.
any suggestions?

Produits

Question posée :

le 8 Mai 2014

Commenté :

le 22 Mai 2014

Community Treasure Hunt

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

Start Hunting!

Translated by