How can I split a matrix into N different parts?
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
ANKUR KUMAR
2018-9-12
编辑:ANKUR KUMAR
2018-9-12
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 个评论
ANKUR KUMAR
2018-9-13
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!