set some values to zero in a matrix or vector

42 次查看(过去 30 天)
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!

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2011-5-30
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 个评论
Oleg Komarov
Oleg Komarov 2011-5-31
That's what Fangjun's solution does. Did you try his snippet?
Fangjun Jiang
Fangjun Jiang 2011-5-31
@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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by