lambda function with if statement
Mostra commenti meno recenti
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)
Risposte (3)
Erivelton Gualter
il 6 Mag 2019
2 voti
You can use the following line of code:
X = @(om) (1*(abs(om)==1) + 0*(abs(om)~=1));
NIMMALA HARATHI
il 23 Mag 2020
0 voti
[X, lambda] = eig(A)
saideh zare
il 4 Lug 2021
0 voti
Unrecognized function or variable 'lambda'.
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!