How to increase or decrease granularity of a matrix?
显示 更早的评论
I want to increase or decrease the granularity of a matrix by a scalar factor, which would look like this:
Increasing Granularity
Increasing the granularity of a matrix replicates elements to scale the size of the matrix up by an integer factor.
A = [1 2
3 4]
B = increase(A, 2)
B = [1 1 2 2
1 1 2 2
3 3 4 4
3 3 4 4]
Decreasing Granularity
Decreasing the granularity of a matrix averages together elements to scale the size of the matrix down by an integer factor.
C = [1 2 3 4
5 6 7 8
4 1 8 3
6 7 2 5]
D = decrease(C, 2)
D = [(1+2+5+6)/4 (3+4+7+8)/4
(4+1+6+7)/4 (8+3+2+5)/4]
D = [3.5 5.5
4.5 4.5]
Is there a way to accomplish these workflows in MATLAB?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!