How to define function
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Viktoriia Buliuk
el 11 de Ag. de 2020
Comentada: Viktoriia Buliuk
el 4 de Sept. de 2020
Hello!
Could you, please, suggest an answer:
How to define function f (x), which for x from -1 to 1, f (x) = 1; and outside these limits f (x) = 0.
Thank in advance!
3 comentarios
Respuesta aceptada
hosein Javan
el 11 de Ag. de 2020
function y = f(x)
y = zeros(size(x));
y(abs(x) < 1) = 1;
end
5 comentarios
hosein Javan
el 11 de Ag. de 2020
ofcourse unless you want to use function file, you need this multiplication only to define your function in anonymous form. correct.
Más respuestas (0)
Ver también
Categorías
Más información sobre Operators and Elementary Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!