how to define the following function
Mostrar comentarios más antiguos
How to define the following function in MATLAB
f(x) = 1 for 0<= x <= pi
f(x) = 1 for 0<= x <= pi
1 comentario
Walter Roberson
el 21 de En. de 2013
You seem to have the same entry twice ?
Respuestas (1)
Thorsten
el 21 de En. de 2013
if 0 <= x && x <= pi, y = 0; end
1 comentario
Walter Roberson
el 21 de En. de 2013
Or, vectorized:
y = zeros(size(x));
y(x >= 0 & x <= pi) = 1;
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!