how can i define a piecewise function in matlab
이전 댓글 표시
how i define a function like this h=0 when x-w/2<=d<=x+w/2 h=1 otherwise
답변 (1개)
Sean de Wolski
2012년 10월 12일
Use logical indexing, for this case, you don't even need to apply the logical indices:
h = ~(x-w/2 <= d & d <= x+w/2);
카테고리
도움말 센터 및 File Exchange에서 Entering Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!