color area between two shapes
이전 댓글 표시
I have two shapes and I want to color the area between them
The first shape is a circle of Radius R=10 for example and with center (0,0),
and the second shape is a random shape but surrounds the cirle and may have communs points, but it is impossible to have points inside the circle (as in the picture).
and the second shape is a random shape but surrounds the cirle and may have communs points, but it is impossible to have points inside the circle (as in the picture).As example for real data that I have:
load('data.mat'); % load the coordinates of the second random shape represented as 'xfs' and 'yfs'
%%%%%%%%% create the circle %%%%%%%%%%
R = 10; C = [0. 0.] ;
xcf = C(1)+R*cos(linspace(0,2*pi,length(xfs))) ;
ycf = C(2)+R*sin(linspace(0,2*pi,length(xfs))) ;
댓글 수: 6
Star Strider
2021년 4월 22일
It is not possible to read the attached file. I tried several different ways to open it and all attempts failed.
Try saving it again as a .mat file, rather than giving it a .m suffix.
Khoder Makkawi
2021년 4월 22일
Matt J
2021년 4월 22일
The data.mat file does not contain data resembling the posted shape.
Khoder Makkawi
2021년 4월 22일
Let's plot it right now:
load(websave('t','https://www.mathworks.com/matlabcentral/answers/uploaded_files/592700/data.mat'))
scatter(xfs,yfs)
Khoder Makkawi
2021년 4월 22일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

