Function Handle for a Rectangular Function

1 Ansicht (letzte 30 Tage)
AEW
AEW am 12 Apr. 2022
Kommentiert: Voss am 12 Apr. 2022
Would it be possible to create a function handle for a rectangular function defined as follows?
Thanks.

Akzeptierte Antwort

Voss
Voss am 12 Apr. 2022
% 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 Kommentare
AEW
AEW am 12 Apr. 2022
Thank you!
Voss
Voss am 12 Apr. 2022
You're welcome!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by