set some values to zero in a matrix or vector

76 views (last 30 days)
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!

Answers (1)

Fangjun Jiang
Fangjun Jiang on 30 May 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 Comments
Oleg Komarov
Oleg Komarov on 31 May 2011
That's what Fangjun's solution does. Did you try his snippet?
Fangjun Jiang
Fangjun Jiang on 31 May 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.

Sign in to comment.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!