📄 isidentity.m
字号:
function yesno = isidentity(S)% ISIDENTITY -- checks whether symbolic object is the identity matrix%% yesno = isidentity(S)%% If the symbolic matrix S contains only entries which can be% converted to numbers, and equals an identity matrix (within tolerance),% this routine returns yesno=1, otherwise yesno=0.%% If the matrix contains symbolic variables even after simplification,% it is not recognized as the identity matrix, even though that may be wrong.% It is conceivable that a complicated expression might simplify% to one or zero, even though Matlab does not see how to simplify it.% Copyright (c) 2004 by Fritz Keinert (keinert@iastate.edu),% Dept. of Mathematics, Iowa State University, Ames, IA 50011.% This software may be freely used and distributed for non-commercial% purposes, provided this copyright statement is preserved, and% appropriate credit for its use is given.%% Last update: Feb 20, 2004% Matlab cannot handle symbolic matrices of more than two% dimensions correctly. We need to string S out first.n = size(S);S = simplify(S(:));try D = reshape(double(S),n); yesno = isidentity(D);catch% if S contains symbolic variables without numerical values,% the conversion to "double" will fail. Then we end up here. yesno = 0;end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -