Complex question: Want to find [x,y] when z > 0.5 from z of other surfaces.
조회 수: 1 (최근 30일)
이전 댓글 표시
For instance, I have three basic surface plots:
x = [-10:10]; y = [-10:10]; test1 = x + 0.5*y; test2 = x + y; test3 = x + 1.5*y;
Which equate to:
test1 =
Columns 1 through 9
-15.0000 -13.5000 -12.0000...
test2 =
Columns 1 through 9
-20 -18 -16...
test3 =
Columns 1 through 13
-25.0000 -22.5000 -20.0000...
Goal: I want to find out [x,y] when test2 deviates from test1 AND test3 by > 4.5.
So in the example above, I would want to know the [x,y] when test2 = -20, because clearly it is when test2 deviates from test1 AND test3 by > 4.5.
(i.e., column1 in all three equations is where absolutevalue(-20-(-15)) AND absolutevalue(-20-(-25) is > 4.5; so I want to know at what [x,y] this occurs)
Thank you!
댓글 수: 0
채택된 답변
Star Strider
2014년 5월 1일
This works:
x = [-10:10];
y = [-10:10];
test1 = @(x,y) x + 0.5*y;
test2 = @(x,y) x + y;
test3 = @(x,y) x + 1.5*y;
[X,Y] = meshgrid(x,y);
T1 = test1(X,Y); % Generate surfaces
T2 = test2(X,Y);
T3 = test3(X,Y);
D = (abs(T2-T1)+abs(T2-T3)) > 4.5; % Differences
[Dr,Dc] = find(D); % Indices where D == 1
figure(1)
surf(X,Y,T1)
hold on
surf(X,Y,T2)
surf(X,Y,T3)
hold off
grid on
figure(2)
surf(X, Y, double(D))
댓글 수: 8
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!