![]() |
IntervalPURPOSE
Interval constructor
SYNOPSIS
function I=Interval(varargin)
DESCRIPTION
Interval constructor Possible inputs are; another interval, a real matrix (a punctual interval is created), two real matrices (one for the lower bounds and another for upper ones). NOTE: this interval arithmetics implementation is NOT numerically save. Rounding effects are not taken into account. However, for our purposes this is not relevant. Check this http://www.ti3.tu-harburg.de/rump/intlab If you need a proper implementation of interval arithmetics in Matlab. CROSS-REFERENCE INFORMATION
This function calls:
SOURCE CODE
0001 function I=Interval(varargin) 0002 % Interval constructor 0003 % 0004 % Possible inputs are; another interval, a real matrix (a punctual interval 0005 % is created), two real matrices (one for the lower bounds and another for 0006 % upper ones). 0007 % 0008 % NOTE: this interval arithmetics implementation is NOT numerically 0009 % save. Rounding effects are not taken into account. However, for our 0010 % purposes this is not relevant. 0011 % Check this 0012 % http://www.ti3.tu-harburg.de/rump/intlab 0013 % If you need a proper implementation of interval arithmetics in Matlab. 0014 0015 switch nargin 0016 case 1 0017 if isa(varargin{1},'Interval') 0018 I=varargin{1}; 0019 else 0020 if isa(varargin{1},'double') 0021 I=Interval(varargin{1},varargin{1}); 0022 else 0023 error('Wrong parameter type in interval creation'); 0024 end 0025 end 0026 case 2 0027 if isa(varargin{1},'double') && isa(varargin{2},'double') 0028 [r1 c1]=size(varargin{1}); 0029 [r2 c2]=size(varargin{1}); 0030 if (r1==r2) && (c1==c2) 0031 I.lower=zeros(r1,c1); 0032 I.upper=zeros(r1,c1); 0033 for i=1:r1 0034 for j=1:c1 0035 a=varargin{1}(i,j); 0036 b=varargin{2}(i,j); 0037 if b<a 0038 error('Empty range in interval creation'); 0039 end 0040 I.lower(i,j)=a; 0041 I.upper(i,j)=b; 0042 end 0043 end 0044 I.r=r1; 0045 I.c=c1; 0046 I=class(I,'Interval'); 0047 else 0048 error('Parameter of diferent sizez in interval creation'); 0049 end 0050 else 0051 error('Wrong parameter type in interval creation'); 0052 end 0053 otherwise 0054 error('Wrong number of parameters in interval creation'); 0055 end |