matlab.unittest.constraints.IsReal 클래스
패키지: matlab.unittest.constraints
슈퍼클래스: matlab.unittest.constraints.BooleanConstraint
실수 값 배열을 규정하는 제약 조건
생성
IsReal
은 실수 값 배열을 규정하는 제약 조건을 제공합니다. 이 제약 조건은 실제 값이 실수 값만을 포함하는 경우에만 충족됩니다.
복사 의미 체계
값입니다. 값 클래스가 복사 작업에 미치는 영향에 대한 내용은 객체 복사 항목을 참조하십시오.
예제
실제 값 배열이 실수 값인지 테스트
대화형 방식 테스트를 위한 테스트 케이스를 생성합니다.
import matlab.unittest.TestCase import matlab.unittest.constraints.IsReal testCase = TestCase.forInteractiveUse;
값 5
및 5+0i
이 실수인지 확인합니다.
testCase.verifyThat(5, IsReal) testCase.verifyThat(5+0i, IsReal)
Interactive verification passed. Interactive verification passed.
허수가 실수인지 테스트합니다.
testCase.verifyThat(sqrt(-1), IsReal)
Interactive verification failed. --------------------- Framework Diagnostic: --------------------- IsReal failed. --> The value must be real. Actual Value: 0.000000000000000 + 1.000000000000000i
실제 값이 허수입니다.
배열이 실수 값만 포함하는지 어설션합니다.
testCase.assertThat([0 1 1 2 3 5 8 13], IsReal)
Interactive assertion passed.
배열 arr
이 실수인지 테스트합니다.
arr = [NaN -Inf]; testCase.verifyThat(arr, IsReal)
Interactive verification passed.
배열과 복소수를 곱하여 해당 값이 실수가 아닌지 테스트합니다.
testCase.verifyThat(42i*arr, ~IsReal)
Interactive verification passed.
참고 항목
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 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)