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!