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) は、IsLeftClosed プロパティと IsRightClosed プロパティを Name, Value のペアの引数として指定し、a から b までの区間を作成します。

interval = fixed.Interval(numerictype) は、指定された数値型の表現可能な最小値と最大値に等しい端点で区間または区間の配列を作成します。

interval = fixed.Interval({___}, ...,{___}) は、各 cell 配列が 1 つ以上のオブジェクトに対する引数を指定する Interval オブジェクトの配列を返します。

入力引数

すべて展開する

区間の左の端点。スカラーまたはベクトルとして指定します。

区間の右の端点。スカラーまたはベクトルとして指定します。

区間が閉じているか、開いているか、半分開いているかを示す引数。次のいずれかの文字ベクトルとして指定します。

endnotes説明
'[]'その両端点が含まれる閉じているセットを生成します。
'[)'最初の端点が含まれ、2 つ目の端点はセットに含まれない半開区間を生成します。
'(]'最初の端点は含まれず、2 つ目の端点がセットに含まれる半開区間を生成します。
'()'どちらの端点もセットに含まれない、開いているセットを生成します。

例: 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

区間の右端が閉じているかどうか。logical 値として指定します。

このプロパティはオブジェクト作成後は編集できません。

データ型: logical

オブジェクト関数

contains一方の fixed.Interval オブジェクトにもう一方が含まれているかどうかの判別
intersectfixed.Interval オブジェクトの交差
isDegeneratefixed.Interval オブジェクトの左端と右端が縮退かどうかの判別
isLeftBoundedfixed.Interval オブジェクトが左端で制限されているかどうかの判別
isRightBoundedfixed.Interval オブジェクトが右端で制限されているかどうかの判別
isnanfixed.Interval オブジェクトが NaN であるかどうかの判別
overlaps2 つの fixed.Interval オブジェクトがオーバーラップするかどうかの判別
quantize数値データ型の範囲への区間の量子化
setdifffixed.Interval オブジェクトの差集合
unionfixed.Interval オブジェクトの結合
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

1 つの点のみが含まれる縮退した区間を作成します。

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

  1x1 fixed.Interval with properties:

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

これは、2 つの等価な端点で区間を作成することに相当します。

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

2 番目ではなく、最初の端点が含まれる区間を作成するには、端点の記号を '[)' として指定します。

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 オブジェクトの引数が含まれる cell 配列のセットを指定できます。

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 で導入