Function Handle for a Rectangular Function

Would it be possible to create a function handle for a rectangular function defined as follows?
Thanks.

 채택된 답변

Voss
Voss 2022년 4월 12일
% rect = @(t)double(0<=t & t<=1); % returns double array (1/0)
rect = @(t)0<=t & t<=1; % returns logical array (true/false)
t = -1:0.01:2;
plot(t,rect(t));
ylim([-1 2]);

댓글 수: 2

AEW
AEW 2022년 4월 12일
Thank you!
Voss
Voss 2022년 4월 12일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

AEW
2022년 4월 12일

댓글:

2022년 4월 12일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by