📄 iszero.m
字号:
function yesno = iszero(S)% ISZERO -- checks whether a symbolic matrix contains only zeros%% yesno = iszero(S)%% If the symbolic matrix S contains only entries which can be% converted to numbers, and all of them are zero (within tolerance),% this routine returns yesno=1, otherwise yesno=0.%% If the matrix contains symbolic variables even after simplification,% it is classified as nonzero, even though that may be wrong. It is% conceivable that one of the entries is a complicated expression which is% 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.S = simplify(S(:));try S = double(S); yesno = iszero(S);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 + -