Borrar filtros
Borrar filtros

set some values to zero in a matrix or vector

42 visualizaciones (últimos 30 días)
Hongmei Hu
Hongmei Hu el 30 de Mayo de 2011
Hi everyone,
I am doing the svd in Simulink, I got the eigenvalue, now I want to set some eigenvalues smaller than a given value to zero. for example, if the eigenvalue small than 2, i set it to zero and keep the those eigen values large than 2 unchanged, incuding the place in the matix and the value.
PS: my matlab is 2009b, there are no Find block. so I can not use that block to find the zero value also.
Thank you very much!

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 30 de Mayo de 2011
How do you do it in Simulink? It sounds like a Matlab data processing problem, e.g.
a=4*rand(3,3)
a(a<2)=0
If you do it in Simulink, what I can think of is that you demux your matrix to individual value, and then use a switch block to compare these individual value, if it is less than 2 then output zero, otherwise, pass it through. At the end, mux them together.
  3 comentarios
Oleg Komarov
Oleg Komarov el 31 de Mayo de 2011
That's what Fangjun's solution does. Did you try his snippet?
Fangjun Jiang
Fangjun Jiang el 31 de Mayo de 2011
@Oleg, I think she is asking if there is an easier way to do it in Simulink. The approach I suggested above in Simulink is a brutal force approach.
@Hongmei Hu, Is there a particular reason that you have to do it in Simulink? To me, SVD is best dealt with using Matlab.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by