
matlab语言&数模
# matlab语言
OPA_heiyaa
嗨嗨嗨
展开
-
reshape(A,a,b)生成目标矩阵
%A=[1,2,3,4,5;10,9,8,7,6;11,12,13,14,15;16,17,18,19,20;21,22,23,24,25]; a = [1:5 10:-1:6]; b = 11:25; A = [reshape(a,5,2)'; reshape(b,5,3)'] B=reshape(A,5,5); C=B([2],[2,3]); D=B([2,3,4],[4]); E=B([4...原创 2019-12-06 21:18:07 · 691 阅读 · 0 评论 -
matlab 验证魔方矩阵
function mofang(A) [n,m]=size(A); if n<3||m<3,disp('error'); elseif n~=m,disp('the size of M X must be N-by-N M'); else B=[sum(A,1),sum(A,2)',sum(diag(A))',sum(diag(rot90(A)))']; if B(1)==B...原创 2019-12-06 21:16:09 · 3574 阅读 · 1 评论