how to define the following function
Ältere Kommentare anzeigen
How to define the following function in MATLAB
f(x) = 1 for 0<= x <= pi
f(x) = 1 for 0<= x <= pi
1 Kommentar
Walter Roberson
am 21 Jan. 2013
You seem to have the same entry twice ?
Antworten (1)
Thorsten
am 21 Jan. 2013
if 0 <= x && x <= pi, y = 0; end
1 Kommentar
Walter Roberson
am 21 Jan. 2013
Or, vectorized:
y = zeros(size(x));
y(x >= 0 & x <= pi) = 1;
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!