How do I detect overlapping areas of a multiple pcolor plots on a single window

2 views (last 30 days)
I'm trying to pull out the areas that multiple pcolor surfaces overlap in on a plot so I can plot that surface with a different color. The two that overlap in this case are the bottom two, but I'm trying to figure out how to, for each circle, detect overlap with one another, and then shade that area of overlap in differently. And yes, I know theta is spelled wrong. It's someone else's code that I'm re-purposing and yes I know that the z values are not actually signal strength. I just tied them there for proof of concept.
Thanks for the help.
grid on
hold on
%----------------------------------
% 1.- 3-D Mesh: Azimuth & Elevation
%----------------------------------
n_tehta = 130; % Samples on Elevation
n_phi = 130; % Samples on Azimuth
[tehta,phi]=meshgrid(0:pi/(n_tehta-1):pi,...
0:2*pi/(n_phi-1):2*pi) ;
%----------------------------------
% 2.- Example Expression (dipole)
%--------------------------------
Bas = 0.5; % Half Wave Dipole
Num = cos(pi*Bas*cos(tehta))-cos(pi*Bas);
Den = sin(tehta);
radio = 1*Num./Den;
%----------------------------------
% 3.- Tranforming to XYZ
%-----------------------
X=30.*radio.*sin(tehta).*cos(phi);
Y=30.*radio.*sin(tehta).*sin(phi);
r=rand(130,130)^3;
r=r+ones(130,130);
Z=r.^rand(1,1)*tehta;
%----------------------------------
% 4.- Representing the result
%-----------------------------
n=5; %# of contours
Trans=0.4; %Alpha Value
%----------------------------------
Zmin=min(Z);
Zmin=min(Zmin);
Zmax=max(Z);
Zmax=max(Zmax);
%----------------------------------
%%Column 1
m=pcolor(1.2.*X-135,0.7.*Y+162,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
m=pcolor(1.2.*X-138,1.1.*Y+102,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
m=pcolor(1.2.*X-135,0.8.*Y+44,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
m=pcolor(0.5.*X-135,0.6.*Y-20,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
%----------------------------------
%%Column 2
m=pcolor(.9.*X+16,0.75.*Y+164,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
m=pcolor(.4.*X+16,.4.*Y+101,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
m=pcolor(.5.*X+12,0.5.*Y+41,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
m=pcolor(1.7.*X+14,1.7.*Y-20,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
%----------------------------------
%%Column 3
m=pcolor(.9.*X+165,0.75.*Y+162,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
m=pcolor(.4.*X+166,.4.*Y+101,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
m=pcolor(.8.*X+163,0.6.*Y+40,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
m=pcolor(1.5.*X+162,1.3.*Y-20,Z);
set(m,'EdgeAlpha',0,'FaceAlpha',Trans);
caxis([Zmin,Zmax])
view(0,90)

Answers (0)

Community Treasure Hunt

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

Start Hunting!