How can I split a matrix into N different parts?
4 views (last 30 days)
Show older comments
Hey Guys, I have a matrix X (80,160), and I want to divide it in to 18 regions. You can find the regions specifications in the picture. I could divide them into 18 almost equal parts but that is not what I need.I actually could not figure out how to divide it into those kind of regions. I would appreciate if anybody can help. Thanks
2 Comments
Answers (1)
ANKUR KUMAR
on 12 Sep 2018
Edited: ANKUR KUMAR
on 12 Sep 2018
Firstly change data into polar coordinates, so that your complete data will change into angles and radius. After conversion, your data will be of dimension (360 [angles]* 100 [assumed as radius]) After this, you can easily crop data as your wish (as mentioned in your image).
You conversion will somewhat looks like
[xx,yy]=pol2cart(angle,radius);
z=interp2(lon,lat,data,xx,yy);
where 'lon', 'lat' is the x and y coordinates of your rectangular dataset ('data')
2 Comments
ANKUR KUMAR
on 13 Sep 2018
After conversion into polar, your data will be in dimension of 360 * 100 (assuming angular resolution is 1 degree and radius has 100 units). As per your figure, suppose 1st part is around 60 to 120 degree and radius may be 66 to 100 units. Then simply do
A_cropped=A(60:120,66:100);
where A is the polar converted matrix.
The only hurdle in your problem is conversion. Once you are done with the conversion, it's very easy to crop the data as per your figure.
See Also
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!