Small matrix values
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nikolaos
le 5 Déc 2011
Réponse apportée : narendra kumar
le 23 Juil 2016
Hallo,
for a given matrix is there an efficient way in matlab to make its small values (e.g. smaller than 0.001) set as zero?
Thanks in advance
0 commentaires
Réponse acceptée
Andrei Bobrov
le 5 Déc 2011
e.g. A - your matrix
A(abs(A)<1e-3)=0
2 commentaires
Walter Roberson
le 5 Déc 2011
A(abs(real(A))<0.001 | abs(imag(A))<0.001) = 0;
Note though that if you had a number such as 12345+0i then this would be set to 0, because you asked for the value to be set to 0 if *either* the real or imaginary part were small. You might wish to change the | to &
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!