how to define the following function
이전 댓글 표시
How to define the following function in MATLAB
f(x) = 1 for 0<= x <= pi
f(x) = 1 for 0<= x <= pi
댓글 수: 1
Walter Roberson
2013년 1월 21일
You seem to have the same entry twice ?
답변 (1개)
Thorsten
2013년 1월 21일
if 0 <= x && x <= pi, y = 0; end
댓글 수: 1
Walter Roberson
2013년 1월 21일
Or, vectorized:
y = zeros(size(x));
y(x >= 0 & x <= pi) = 1;
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!