matlab.unittest.constraints.IsFinite クラス
パッケージ: matlab.unittest.constraints
スーパークラス: matlab.unittest.constraints.BooleanConstraint
有限値を指定する制約
構築
IsFinite
は、実際の値の配列ですべての値が有限かどうかを判別できる制約を作成します。この制約は、実際の値の配列に無限値または NaN
値が含まれない場合にのみ満たされます。
コピーのセマンティクス
値。値クラスがコピー操作に与える影響については、オブジェクトのコピーを参照してください。
例
実際の値の配列に有限値のみが含まれることをテスト
対話型テスト用にテスト ケースを作成します。
import matlab.unittest.TestCase import matlab.unittest.constraints.IsFinite testCase = TestCase.forInteractiveUse;
値 17
が制約を満たすことをテストします。
testCase.verifyThat(17, IsFinite)
Interactive verification passed.
配列は完全に有限であることをアサートします。
testCase.assertThat([0 1 1 2 3 5 8 13], IsFinite)
Interactive assertion passed.
配列が完全に有限であることを検証します。
testCase.verifyThat([-Inf 5 NaN], IsFinite)
Interactive verification failed. --------------------- Framework Diagnostic: --------------------- IsFinite failed. --> All elements must be finite-valued. Failing indices: 1 3 Actual Value: -Inf 5 NaN
配列には無限値が含まれます。
虚数部が無限大である複素数が制約を満たすかどうかをテストします。
testCase.assertThat(42+Inf*1i, IsFinite)
Interactive assertion failed. --------------------- Framework Diagnostic: --------------------- IsFinite failed. --> The value must be finite. Actual Value: 42.000000000000000 + Infi Assertion failed.
配列に有限値が含まれないことを検証します。
testCase.verifyThat([NaN -7+NaN*1i], ~IsFinite)
Interactive verification passed.
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)