📄 xelimrc.m
字号:
% xelimrc.m
% Scope: This MATLAB program tests the macros elimrow and elimcol.
% Usage: xelimrc
% Inputs: - number of rows of the input matrix (greater than 1)
% - number of columns of the input matrix (greater than 1)
% Outputs: - the resultant matrices after the elimination of rows/columns
% are displayed on the screen
% External Matlab macros used: elimcol, elimrow
% Last update: 06/27/00
% Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.
clear
disp(' ');
disp('Generate the original matrix');
nrow = input('Enter the number of rows (greater than 1) --> ');
ncol = input('Enter the number of columns (greater than 1) --> ');
% Generate an m by n matrix with random entries uniformly distributed in the
% interval (0,1), and display on screen the generated matrix
disp(' ');
disp('The original matrix');
a = rand(nrow,ncol)
disp('Press any key to continue');
pause
% Eliminate the first row and display on screen the resultant matrix
disp(' ');
disp('The resultant matrix after the elimination of the first row');
b1 = elimrow(a,1)
disp('Press any key to continue');
pause
% Eliminate the last row and display on screen the resultant matrix
disp(' ');
disp('The resultant matrix after the elimination of the last row');
b2 = elimrow(a,nrow)
disp('Press any key to continue');
pause
% Eliminate a row (between the first and the last) and display on screen
% the resultant matrix
rowmed = round(0.5 * (1 + nrow));
rmed = int2str(rowmed);
disp(' ');
disp(['The resultant matrix after the elimination of the row # ',rmed]);
b3 = elimrow(a,rowmed)
disp('Press any key to continue');
pause
% Eliminate the first column and display on screen the resultant matrix
disp(' ');
disp('The resultant matrix after the elimination of the first column');
c1 = elimcol(a,1)
disp('Press any key to continue');
pause
% Eliminate the last column and display on screen the resultant matrix
disp(' ');
disp('The resultant matrix after the elimination of the last column');
c2 = elimcol(a,ncol)
disp('Press any key to continue');
pause
% Eliminate a column (between the first and the last) and display on screen
% the resultant matrix
colmed = round(0.5 * (1 + ncol));
cmed = int2str(colmed);
disp(' ');
disp(['The resultant matrix after the elimination of the column # ',cmed]);
c3 = elimcol(a,colmed)
disp('Press any key to continue');
pause
disp(' ');
disp('End of the program XELIMRC');
disp(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -