Main Content

fixed.Interval

값의 구간 정의

R2019b 이후

설명

fixed.Interval 객체는 실제 값의 구간을 정의합니다. Interval 객체를 사용하여 fixed.DataSpecification 객체의 값 범위를 지정할 수 있습니다.

생성

설명

예제

interval = fixed.Interval은 단위 구간 [0,1]을 생성합니다.

예제

interval = fixed.Interval(a)는 값 a만 포함하는 퇴화된 구간을 생성합니다.

interval = fixed.Interval(a, b)a부터 b까지의 닫힌 구간을 생성합니다.

예제

interval = fixed.Interval(a, b, endnotes)는 열린 구간인지 아니면 닫힌 구간인지를 지정하는 endnotes 인수를 사용하여 a부터 b까지의 구간을 생성합니다.

interval = fixed.Interval(a, b, Name, Value)IsLeftClosedIsRightClosed 속성을 Name, Value 쌍 인수로 지정하여 a에서 b까지의 구간을 생성합니다.

예제

interval = fixed.Interval(numerictype)은 끝점이 포함된 단일 구간 또는 이러한 구간으로 구성된 배열을 생성합니다. 여기서 끝점은 지정된 숫자형의 표현 가능한 최솟값 및 최댓값과 같습니다.

예제

interval = fixed.Interval({___}, ...,{___})Interval 객체로 구성된 배열을 반환합니다. 여기서 각 셀형 배열은 하나 이상의 객체에 대한 인수를 지정합니다.

입력 인수

모두 확장

구간의 왼쪽 끝점으로, 스칼라 또는 벡터로 지정됩니다.

구간의 오른쪽 끝점으로, 스칼라 또는 벡터로 지정됩니다.

닫힌 구간인지, 열린 구간인지 아니면 반열린 구간인지를 나타내는 인수로, 다음 문자형 벡터 중 하나로 지정됩니다.

endnotes설명
'[]'양쪽 끝점이 포함된 닫힌 집합을 생성합니다.
'[)'집합에 첫 번째 끝점은 포함되지만 두 번째 끝점은 포함되지 않는 반열린 구간을 생성합니다.
'(]'집합에 첫 번째 끝점은 포함되지 않지만 두 번째 끝점은 포함되는 반열린 구간을 생성합니다.
'()'집합에 어느 끝점도 포함되지 않는 열린 집합을 생성합니다.

예: interval = fixed.Interval(1, 10, '()');

Interval 객체를 정의하는 표현 가능한 값의 범위를 갖는 숫자 데이터형으로, Simulink.Numerictype 객체, embedded.numerictype 객체 또는 숫자 데이터형(예: 'single')을 나타내는 문자형 벡터로 지정됩니다.

numerictype'double', 'single' 또는 'half'인 경우 출력 Interval 객체는 구간 [-Inf], [Inf], [NaN], [-realmax, realmax]를 갖는 4개의 Interval 객체로 구성된 배열입니다. 데이터형의 표현 가능한 값에 대한 자세한 내용은 realmax 항목을 참조하십시오.

예: interval = fixed.Interval('fixdt(1,16,8)');

속성

모두 확장

구간의 왼쪽 끝점으로, 스칼라로 지정됩니다.

이 속성은 객체 생성 후에는 편집할 수 없습니다.

데이터형: half | single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | fi

구간의 오른쪽 끝점으로, 스칼라로 지정됩니다.

이 속성은 객체 생성 후에는 편집할 수 없습니다.

데이터형: half | single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | fi

구간의 왼쪽 끝이 닫혔는지 여부로, 논리값으로 지정됩니다.

이 속성은 객체 생성 후에는 편집할 수 없습니다.

데이터형: logical

구간의 오른쪽 끝이 닫혔는지 여부로, 논리값으로 지정됩니다.

이 속성은 객체 생성 후에는 편집할 수 없습니다.

데이터형: logical

객체 함수

containsDetermine if one fixed.Interval object contains another
intersectIntersection of fixed.Interval objects
isDegenerateDetermine whether the left and right ends of a fixed.Interval object are degenerate
isLeftBoundedDetermine whether a fixed.Interval object is left-bounded
isRightBoundedDetermine whether a fixed.Interval object is right-bounded
isnanDetermine whether a fixed.Interval object is NaN
overlapsDetermine if two fixed.Interval objects overlap
quantizeQuantize interval to range of numeric data type
setdiffSet difference of fixed.Interval objects
unionUnion of fixed.Interval objects
uniquefixed.Interval 객체의 고유 값 세트 가져오기

예제

모두 축소

디폴트 속성값을 사용하는 Interval 객체를 만듭니다. 끝점 값을 지정하지 않는 경우 Interval 객체는 끝점 0과 1을 사용합니다.

interval = fixed.Interval()
interval = 
    [0,1]

  1x1 fixed.Interval with properties:

              LeftEnd: 0
             RightEnd: 1
         IsLeftClosed: true
        IsRightClosed: true

단일 점만 포함하는 퇴화된 구간을 생성합니다.

interval = fixed.Interval(pi)
interval = 
    [3.1416]

  1x1 fixed.Interval with properties:

              LeftEnd: 3.1416
             RightEnd: 3.1416
         IsLeftClosed: true
        IsRightClosed: true

이는 동일한 두 개의 끝점을 갖는 구간을 생성하는 것과 같습니다.

interval = fixed.Interval(pi, pi)
interval = 
    [3.1416]

  1x1 fixed.Interval with properties:

              LeftEnd: 3.1416
             RightEnd: 3.1416
         IsLeftClosed: true
        IsRightClosed: true

열린 구간을 생성하기 위한 구간의 끝 표시를 지정합니다.

interval = fixed.Interval(-1, 1,'()') %#ok<*NASGU> 
interval = 
    (-1,1)

  1x1 fixed.Interval with properties:

              LeftEnd: -1
             RightEnd: 1
         IsLeftClosed: false
        IsRightClosed: false

첫 번째 끝점은 포함되지만 두 번째 끝점은 포함되지 않는 구간을 생성하려면 끝 표시를 '[)'로 지정합니다.

interval = fixed.Interval(-1, 1,'[)')
interval = 
    [-1,1)

  1x1 fixed.Interval with properties:

              LeftEnd: -1
             RightEnd: 1
         IsLeftClosed: true
        IsRightClosed: false

fixed.Interval 객체의 생성자에 숫자 데이터형을 지정할 경우 구간 범위는 데이터형 범위로 설정됩니다.

int8형 범위를 갖는 구간을 생성합니다.

interval_int8 = fixed.Interval('int8')
interval_int8 = 
    [-128,127]

  1x1 fixed.Interval with properties:

              LeftEnd: -128
             RightEnd: 127
         IsLeftClosed: true
        IsRightClosed: true

또한 Simulink.NumericType을 지정하여, NumericType 객체로 표현 가능한 범위와 동일한 범위를 갖는 구간을 생성할 수 있습니다.

myNumericType = Simulink.NumericType;
myNumericType.DataTypeMode = "Fixed-point: binary point scaling";
myNumericType.Signedness = 'Unsigned';
myNumericType.WordLength = 16;
myNumericType.FractionLength = 14
myNumericType = 
  NumericType with properties:

      DataTypeMode: 'Fixed-point: binary point scaling'
        Signedness: 'Unsigned'
        WordLength: 16
    FractionLength: 14
           IsAlias: 0
         DataScope: 'Auto'
        HeaderFile: ''
       Description: ''

interval_16_14 = fixed.Interval(myNumericType)
interval_16_14 = 
    [0,3.9999]

  1x1 fixed.Interval with properties:

              LeftEnd: 0
             RightEnd: 3.9999
         IsLeftClosed: true
        IsRightClosed: true

fixed.Interval 객체로 구성된 배열을 생성하려면, Interval 객체의 인수가 각각 포함된 일련의 셀형 배열을 Interval 객체의 생성자에 지정하면 됩니다.

intervalarray = fixed.Interval({-1,1},{5,10,'[)'},...
    {1000,1500,'IsLeftClosed',1,'IsRightClosed',0},...
    {'int8'})
intervalarray = 
    [-1,1]    [5,10)    [1000,1500)    [-128,127]

  1x4 fixed.Interval with properties:

              LeftEnd
             RightEnd
         IsLeftClosed
        IsRightClosed

버전 내역

R2019b에 개발됨