lambda function with if statement
Ältere Kommentare anzeigen
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)
Antworten (3)
Erivelton Gualter
am 6 Mai 2019
2 Stimmen
You can use the following line of code:
X = @(om) (1*(abs(om)==1) + 0*(abs(om)~=1));
NIMMALA HARATHI
am 23 Mai 2020
0 Stimmen
[X, lambda] = eig(A)
saideh zare
am 4 Jul. 2021
0 Stimmen
Unrecognized function or variable 'lambda'.
Kategorien
Mehr zu Logical 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!