lambda function with if statement
Mostrar comentarios más antiguos
How do I make the following function work for X. I want to be able to write lambda functions with an if clause.
X = @(om) (if abs(om)<1; 1; else 0; end)
Respuestas (3)
Erivelton Gualter
el 6 de Mayo de 2019
2 votos
You can use the following line of code:
X = @(om) (1*(abs(om)==1) + 0*(abs(om)~=1));
NIMMALA HARATHI
el 23 de Mayo de 2020
0 votos
[X, lambda] = eig(A)
saideh zare
el 4 de Jul. de 2021
0 votos
Unrecognized function or variable 'lambda'.
Categorías
Más información sobre Logical 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!