Output argument "variable" (and maybe others) not assigned during call to "function".
Mostrar comentarios más antiguos
I'm new to MATLAB and have created a simple function. However, matlab shows me the following error: Output argument "val" (and maybe others) not assigned during call to "u".
Here is the code:
function val = f(n)
val = u(n) - u(n - 4);
end
Here is u(x):
function val = u(x)
if x < 0
val = 0;
end
if x == 0
val = 0.5;
end
if x > 1
val = 1;
end
end
1 comentario
Stephen23
el 30 de Mzo. de 2018
The possibility that x is non-scalar should also be considered. This code would be much improved by being written completely vectorized.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Whos 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!