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

📄 tmulmat.m

📁 雷达信号处理、或阵列信号处理中能够用上的重要的matlab工具箱——阵列信号处理工具箱
💻 M
字号:
% [ ]Ok *** TEST ***% of: Test of multidimensional matrices in Matlab.% Sign:		Datum:%% *****************************************************************************% RECVAR, A package for new data types in Matlab 4. % (c) FOA 1997. See the file rvright.m for copyright notice.%%  A test program for test of multidimensional matrices in Matlab.%%  Start        : 960930 Svante Bj鰎klund (svabj).%  Latest change: $Date: 1997/12/29 17:04:41 $ $Author: svabj $.%  $Revision: 2.6 $% *****************************************************************************disp('Test of multidimensional matrices in Matlab.')disp('Don''t forget to compile mex-files before the test.')testnr=input('Choose testno: ');while (isempty(testnr))	testnr=input('Choose testno: ');endmore onif (testnr==20)% *****************************************************************************% [ ]  : Test 20% Sign:		Datum:%% *****************************************************************************% Comments%	Testing getnoix.%	Only for Matlab 4.% [ ]disp('Test 20a')[noIx1, noIx2] = matvar('getnoix',[2 2 2 1 1 1], 1:2,1:2,1,1,1,1)[noIx1, noIx2] = matvar('getnoix',[2 2 2 1 1 1], 1:2,1,2:-1:1,1,1,1)[noIx1, noIx2] = matvar('getnoix',[2 2 2 1 1 1], 1,1:2,1:2,1,1,1)[noIx1, noIx2] = matvar('getnoix',[2 2 2 1 1 1], 1,2,1:2,1,1,1)% Expected result :%	2, 2%	2, 2%	2, 2%	2, 1% Real result :% [ ]disp('Test 20b')[noIx1, noIx2] = matvar('getnoix',[2 2 2 1 1 1], 1:2,1:2,1,1:2,1,1)% Expected result :%	Error message: ??? More than two indices are vectors.% Real result :elseif (testnr==21)% *****************************************************************************% [ ]  : Test 21% Sign:		Datum:%% *****************************************************************************% Comments%	Testing expandix.%	Only for Matlab 4.% [ ]disp('Test 21a')v = matvar('expandix',[2 2 2 1 1 1], 1:2,1:2,1,1,1,1)v = matvar('expandix',[2 2 2 1 1 1], 1:2,1,1:2,1,1,1)v = matvar('expandix',[2 2 2 1 1 1], 1,1:2,1:2,1,1,1)% Expected result :%	1 2 3 4%	1 2 5 6%	1 3 5 7% Real result :% [ ]disp('Test 21b')v = matvar('expandix',[2 2 2 1 1 1], 2:-1:1,1:2,1,1,1,1)% Expected result :%	2 1 4 3% Real result :elseif (testnr==23)% *****************************************************************************% [ ]  : Test 23% Sign:		Datum:%% *****************************************************************************% Comments%	Test of multidimensional matrices.% [ ]disp('Test 23a')MM = zerosm([2 2 2]);MM = setm(MM,[1 2; 3 4], 1:2, ':', 1);MM = setm(MM,[5 6; 7 8], ':', ':', 2);getm(MM, ':', ':', 1)getm(MM, 2 ,1:2 ,':')'getm(MM, ':', 2, ':')getm(MM, 1, 2, ':')getm(MM, 2, ':', 1)% Expected result :%	[1 2; 3 4]%	[3 4; 7 8]%	[2 6; 4 8]%	[2 ; 6]%	[3 ; 4]% Real result :elseif (testnr==24)% *****************************************************************************% [ ]  : Test 24% Sign:		Datum:%% Test of getm2.%% *****************************************************************************% [ ]disp('Test 24a')disp('Test of getm2.')MM = zerosm([2 2 2]);MM = setm(MM,[1 2; 3 4], 1:2, ':', 1);MM = setm(MM,[5 6; 7 8], ':', ':', 2);getm2(MM, ':', ':', 1)getm2(MM, 2 ,1:2 ,':')'getm2(MM, ':', 2, ':')getm2(MM, 1, 2, ':')getm2(MM, 2, ':', 1)% Expected result :%	[1 2; 3 4]%	[3 4; 7 8]%	[2 6; 4 8]%	[2 ; 6]%	[3  4]% Real result :elseif (testnr==25)% *****************************************************************************% [ ]  : Test 25% Sign:		Datum:%% Test of getm3.%% *****************************************************************************% [ ]disp('Test 25a')disp('Test of getm3.')MM = zerosm([2 2 2]);MM = setm(MM,[1 2; 3 4], 1:2, ':', 1);MM = setm(MM,[5 6; 7 8], ':', ':', 2);getm3(MM, 1,[], 2 ,1:2 ,':')getm3(MM, 2,[], 2 ,1:2 ,':')getm3(MM, 3,[], 2 ,1:2 ,':')getm3(MM, 1,[], ':' ,1 ,2)getm3(MM, 2,[], ':' ,1 ,2)getm3(MM, 3,[], ':' ,1 ,2)getm3(MM, 1,[], 1, 2, 1:2)getm3(MM, 2,[], 1, 2, 1:2)getm3(MM, 3,[], 1, 2, 1:2)getm3(MM, 1,[], 1, 2, 1)getm3(MM, 2,[], 1, 2, 1)getm3(MM, 3,[], 1, 2, 1)% Expected result :%	Error. "row" index is no vector but there are two other vectors.%	[3 7 ; 4 8]%	[3 4 ; 7 8]%%	[5 ; 7]%	[5 7]%	[5 7]%%	[2 6]%	[2 6]%	[2 ; 6]%%	2%	2%	2% Real result :else  disp('Incorrect testnumber.');end

⌨️ 快捷键说明

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