Function Handle for a Rectangular Function

1 visualizzazione (ultimi 30 giorni)
AEW
AEW il 12 Apr 2022
Commentato: Voss il 12 Apr 2022
Would it be possible to create a function handle for a rectangular function defined as follows?
Thanks.

Risposta accettata

Voss
Voss il 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]);

Più risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by