⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abcdchk.m

📁 数字通信第四版原书的例程
💻 M
字号:
function msg = abcdchck(a,b,c,d)
%ABCDCHK Checks dimensional consistency of A,B,C,D matrices.
%	MSG = ABCDCHK(A,B,C,D) checks the consistency of the dimensions 
%	of A,B,C,D.  Returns the empty matrix if they are, or an
%	an error message string if they are not.
%
%	Valid systems with empty matrices are allowed.  

% 	J.N. Little 3-24-85
%	Copyright (c) 1986-93 by the MathWorks, Inc.
%	Revised 2-25-88 JNL, 6-26-90 CMT, 2-14-91 ACWG

msg = [];
[ma,na] = size(a);
if (ma ~= na)
	msg = 'The A matrix must be square';
end
if (nargin > 1)
	[mb,nb] = size(b);
	if (ma ~= mb)&nb
	msg = 'The A and B matrices must have the same number of rows.';
	end
	if (nargin > 2)
		[mc,nc] = size(c);
		if (nc ~= ma)&mc
 	msg = 'The A and C matrices must have the same number of columns.';
		end
		if (nargin > 3)
			[md,nd] = size(d);
			if ((ma+mb+mc) == 0), return, end
			if (md ~= mc)&(nd | nb)
	msg = 'The C and D matrices must have the same number of rows.';
			end
			if (nd ~= nb)&(md | mc)
	msg = 'The B and D matrices must have the same number of columns.';
			end
		end
	end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -