X and Y co-ordinates of a surface?
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
hi all, i have a surface z=f(x,y).......may i obtain values of x and y if z is known?.....is there any tool for that
0 件のコメント
回答 (1 件)
Mike Garrity
2015 年 7 月 21 日
Depending on the details of your surface, it can be simple, but for the general case, you're probably looking for contour . It takes the same arguments as surface, but gives you a curve which is passes through all of the X,Y positions with a specified Z.
For example:
[x,y,z] = peaks;
C = contour(x,y,z,'LevelList',0);
The format of the returned matrix C is explained here . It's a bit complicated, because there might be several loops of locations with the same Z. The example above returns something like this:

If you look at C, you'll see that the first column is:
>> c(:,1)
ans =
0
70
The 0 in the first row is the Z level, and the 70 in the second row says that there are 70 X,Y pairs in this loop. That means that c(:,2) through c(:71) are the coordinates of the first loop.
Then if we skip ahead to c(:72), we find:
>> c(:,72)
ans =
0
68
That means that c(:,73) through c(:,140) are the coordinates of the second loop. Finally, if we look at c(:,141), we find:
>> c(:,141)
ans =
0
9
which means that c(:,142) through c(:,150) contain the coordinates of the last loop, which is that tiny one in the center of the picture.
Does that make sense?
0 件のコメント
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!