📄 max.m
字号:
function [m,kinf,ksup] = max(a,b,c)
%MAX (interval) computes interval of the possible maximal values.
%
%b4m - datatype interval Version 1.02 (c) 6.5.1998 Jens Zemke
%
% DESCRIPTION:
% 'max' is called
%
% m = max(a)
%
% or
%
% [m,kinf,ksup] = max(a)
%
% or
%
% ...
%
% and computes the interval of possible
% maximum values m, for example
% inf(m) := max {inf(a),inf(b)}
% sup(m) := max {sup(a),sup(b)}
% and two integer matrices containing
% the indices of the maximal arguments.
%
% The operations on the datatype interval
% are based on BIAS by Olaf Knueppel.
%
% SEE ALSO:
% interval: min.
% double: max.
% Last Revision 27.5.1998 by Jens Zemke
if nargin == 1
[ainf, asup] = infsup(a);
[minf,kinf] = max(ainf);
[msup,ksup] = max(asup);
elseif nargin == 2
if any(size(a) - size(b))
error('Matrix dimensions must agree.');
end;
if isa(a, 'interval')
[ainf, asup] = infsup(a);
elseif ~isa(a, 'double')
error('Only the types double and interval are supported.');
elseif imag(a)
error('Complex intervals are not supported.');
elseif isa(a, 'sparse')
error('Sparse intervals are not supported.');
else
ainf = a;
asup = a;
end;
if isa(b, 'interval')
[binf, bsup] = infsup(b);
elseif ~isa(b, 'double')
error('Only the types double and interval are supported.');
elseif imag(b)
error('Complex intervals are not supported.');
elseif isa(b, 'sparse')
error('Sparse intervals are not supported.');
else
binf = b;
bsup = b;
end;
minf = max(ainf,binf);
msup = max(asup,bsup);
else
if ~isempty(b)
error('Incorrect number of inputs.');
end;
if ~isa(c, 'double') | imag(c) | isa(c, 'sparse') | round(c) - c | c < 1 | any(size(c)-1)
error('Dimension argument must be a positive integer scalar.');
end;
[ainf, asup] = infsup(a);
[minf,kinf] = max(ainf,[],c);
[msup,ksup] = max(asup,[],c);
end;
m = interval(minf, msup);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -