主要内容

union

fixed.Interval 对象的并集

说明

C = union(A, B) 返回 fixed.Interval 对象 AB 的并集。

示例

示例

全部折叠

创建两个 fixed.Interval 对象。

interval1 = fixed.Interval(-10, 10)
interval1 = 
    [-10,10]

  1x1 fixed.Interval with properties:

              LeftEnd: -10
             RightEnd: 10
         IsLeftClosed: true
        IsRightClosed: true
interval2 = fixed.Interval(0,20)
interval2 = 
    [0,20]

  1x1 fixed.Interval with properties:

              LeftEnd: 0
             RightEnd: 20
         IsLeftClosed: true
        IsRightClosed: true

找到两个 Interval 对象的并集。

intervalUnion = union(interval1, interval2)
intervalUnion = 
    [-10,20]

  1x1 fixed.Interval with properties:

              LeftEnd: -10
             RightEnd: 20
         IsLeftClosed: true
        IsRightClosed: true

输出是一个 Interval 对象,其范围是两个输入对象的范围的并集。

当两个输入 Interval 对象的范围不重叠时,输出是覆盖输入范围并集的 Interval 对象数组。

interval3 = fixed.Interval(100, 200)
interval3 = 
    [100,200]

  1x1 fixed.Interval with properties:

              LeftEnd: 100
             RightEnd: 200
         IsLeftClosed: true
        IsRightClosed: true
intervalUnion = union(interval1, interval3)
intervalUnion = 
    [-10,10]    [100,200]

  1x2 fixed.Interval with properties:

              LeftEnd
             RightEnd
         IsLeftClosed
        IsRightClosed

输入参数

全部折叠

输入 fixed.Interval 对象,指定为 fixed.Interval 对象或 fixed.Interval 对象数组。

输出参量

全部折叠

输入 fixed.Interval 对象的并集,以 fixed.Interval 对象或 fixed.Interval 对象数组形式返回。

输出 Interval 对象包含 AB 中的所有值。

版本历史记录

在 R2019b 中推出