# Intersection of areas via polyshape

3 views (last 30 days)
Sena Koçak on 23 Jun 2022
Hi everyone,
I need a help with the calculation of the intersection area via polyshape. I wrote a code that is designed to calculate gamma stability area. So, when I run the code and then there exists a point in the area that I cannot delete. Could you help to delete that? I wrote the code as below and I attach the output figure.
Thanks,
clear
clc
close all
wnArr = linspace(125,250,400);
zetaArr = linspace(0.1,0.9,400);
complexRoot1 = zeros(1,length(wnArr));
complexRoot2 = zeros(1,length(wnArr));
complexRoot3 = zeros(1,length(wnArr));
complexRoot4 = zeros(1,length(wnArr));
wnLow = 125; wnUp = 250;
zetaLow = 0.1; zetaUp = 0.9;
for k = 1:length(wnArr)
complexRoot1(k) = -zetaArr(k)*wnLow + 1i*wnLow*sqrt(1-zetaArr(k)^2);
complexRoot2(k) = -zetaArr(k)*wnUp + 1i*wnUp*sqrt(1-zetaArr(k)^2);
complexRoot3(k) = -zetaLow*wnArr(k) + 1i*wnArr(k)*sqrt(1-zetaLow^2);
complexRoot4(k) = -zetaUp*wnArr(k) + 1i*wnArr(k)*sqrt(1-zetaUp^2);
end
real1 = real(complexRoot1); imag1 = imag(complexRoot1);
real2 = real(complexRoot2); imag2 = imag(complexRoot2);
real3 = real(complexRoot3); imag3 = imag(complexRoot3);
real4 = real(complexRoot4); imag4 = imag(complexRoot4);
vertice1 = [transpose([real1 real2 real3 real4]) transpose([imag1 imag2 imag3 imag4])];
vertice2 = [transpose([real1 real2 real3 real4]) transpose([-imag1 -imag2 -imag3 -imag4])];
pgon1 = polyshape([0 0 1 1],[1 0 0 1], 'Simplify',false);
pgon1.Vertices = vertice1;
pgon2 = polyshape([0 0 1 1],[1 0 0 1], 'Simplify',false);
pgon2.Vertices = vertice2;
plot(simplify(simplify(pgon1)),'FaceColor', 'c')
hold on
plot(simplify(simplify(pgon2)),'FaceColor', 'c')
hold off

### Categories

Find more on Elementary Polygons in Help Center and File Exchange

R2022a

### Community Treasure Hunt

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

Start Hunting!