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

조회 수: 1 (최근 30일)
A
A 2014년 4월 15일
편집: A 2014년 4월 17일
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

채택된 답변

Walter Roberson
Walter Roberson 2014년 4월 15일
OfInterest = any(diff( sort( cat(3, surface1Z, surface2Z, surface3Z), 3), 3) > 0.5, 3);
This will be a logical array.
  댓글 수: 3
Walter Roberson
Walter Roberson 2014년 4월 15일
image(ofInterest + 0)
or
image(ofInterest);
colormap(gray(2));
A
A 2014년 4월 17일
편집: A 2014년 4월 17일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by