Complex question: Want to find [x,y] when z > 0.5 from z of other surfaces.

1 view (last 30 days)
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!

Accepted Answer

Star Strider
Star Strider on 1 May 2014
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 Comments
A
A on 24 May 2014
Thank you! I think that works. I used that in combination with the min() function to get it working.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!