How to find when a surface deviates from other surface(s)

1 Ansicht (letzte 30 Tage)
A
A am 15 Apr. 2014
Bearbeitet: A am 17 Apr. 2014
Hi guys,
I have 3 surfaces. I want to find out values for x and y, where each of the three surfaces deviates from the other two by more than 0.5 value on the z axis. Is this a simple enough thing?
I can imagine it being super easy to do with only two surfaces because you could just substract one from the other. But how do I do it with 3 surfaces? Any ideas?
Thanks

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 15 Apr. 2014
OfInterest = any(diff( sort( cat(3, surface1Z, surface2Z, surface3Z), 3), 3) > 0.5, 3);
This will be a logical array.
  3 Kommentare
Walter Roberson
Walter Roberson am 15 Apr. 2014
image(ofInterest + 0)
or
image(ofInterest);
colormap(gray(2));
A
A am 17 Apr. 2014
Bearbeitet: A am 17 Apr. 2014
Hi Walter,
Thanks for your response. I have tried to test this out. Here's what I used:
>> x = [-10:10];
>> y = [-10:10];
>> test1 = x + 0.5*y;
>> test2 = x + y;
>> test3 = x + 1.5*y;
>> testI = meshgrid(test1);
>> testII = meshgrid(test2);
>> testIII = meshgrid(test3);
>> surf(x,y,testI);
>> hold on
>> surf(x,y,testII);
>> surf(x,y,testIII);
>> OfInterest = any(diff( sort( cat(3, test1, test2, test3), 3), 3) > 0.5, 3);
>> OfInterest
OfInterest =
Columns 1 through 15
0 0 0 0 0 0 0 0 1 1 0 0 0 0 0
Columns 16 through 18
0 0 0
>> image(OfInterest);
>> colormap(gray(2));
Just a couple of questions.
1) First of all, am I doing it right?
2) I am not sure how to read this/extrapolate the data that I need, which is the x and y value when z deviates by > 0.5 from either of the other two surfaces.
3) When I plot this using the image/colormap function at the end. I get the attached picture? Again, not sure how to read this?
Thank you

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by