使用函数法、拼接法、拼接函数法和变形函数法,按照要求创建以下短阵:A 为 3×4的全1矩阵、B为3x3的0矩阵、C为3x3的单位阵、D为3x3的魔方阵、E由C和D纵向拼接而成、F抽取E的2~5行元素生成、G由F经变形为3x4的矩阵而得、以G为子矩阵用复制函数(repmat)生成 6x8 的大矩阵H
时间: 2023-06-02 10:01:27 浏览: 139
matlab矩阵数组 -实现图像拼接:相位相关法、投影法
函数法:
A = ones(3,4);
B = zeros(3);
C = eye(3);
D = magic(3);
E = [C;D];
F = E(2:5,:);
G = reshape(F',3,4);
H = repmat(G,2,4);
拼接法:
A = [1 1 1 1;1 1 1 1;1 1 1 1];
B = [0 0 0;0 0 0;0 0 0];
C = [1 0 0;0 1 0;0 0 1];
D = [8 1 6;3 5 7;4 9 2];
E = [C;D];
F = E(2:5,:);
G = [F(1,:);F(2,:);F(3,:);F(4,:)];
H = [G;G;G;G;G;G];
拼接函数法:
A = ones(3,4);
B = zeros(3);
C = eye(3);
D = magic(3);
E = vertcat(C,D);
F = E(2:5,:);
G = reshape(F',3,4);
H = repmat(G,2,4);
变形函数法:
A = ones(3,4);
B = zeros(3);
C = eye(3);
D = magic(3);
E = [C;D];
F = E(2:5,:);
G = reshape(F',3,4);
H = repmat(G,[2,4]);
阅读全文