Filter löschen
Filter löschen

Calculate vector norm in Simulink?

236 Ansichten (letzte 30 Tage)
Joshua
Joshua am 8 Apr. 2013
Kommentiert: Steven Crews am 21 Apr. 2021
Is there a block that finds the norm of a vector in simulink? I haven't found the equivalent to norm(v) from MATLAB.
Thanks!

Akzeptierte Antwort

Jon
Jon am 8 Apr. 2013
You can use the dot product block (with the same vector wired to both inputs) followed by a square root. Both are under the Math Operations library. I think the previously suggested abs block computes the absolute values of each element of the input vector.

Weitere Antworten (4)

Youssef  Khmou
Youssef Khmou am 8 Apr. 2013
hi, it does exist, its called "abs" , open Simulink library and go to :"Math operations" block , its the first on the list, with notation u : ABS
  2 Kommentare
Jon
Jon am 8 Apr. 2013
As noted in my alternative answer, I don't this this gives you what you want. As far as I can tell abs gives the element wise absolute values, not the norm
Steven Crews
Steven Crews am 21 Apr. 2021
Agreed. This is not the correct answer.

Melden Sie sich an, um zu kommentieren.


Joshua
Joshua am 8 Apr. 2013
Thanks!

Youssef  Khmou
Youssef Khmou am 8 Apr. 2013
hi, if the first answer does not work, you can use other ways, like :
1) go to " User Defined Functions" in Simulink Block .
2) choose "f(u)" FCN, add it to your file , right click on it you will find the default value :
sin(u(1)*exp(2.3*(-u(2))))
change it to
"norm(u)"
  4 Kommentare
Jon
Jon am 9 Apr. 2013
I couldn't find and "Embeded function" Do you mean the Interpreted MATLAB Fcn under User Defined Functions? The Interpreted MATLAB Fcn works, but I would guess that the dot product block, followed by the sqrt block is faster, because it doesn't need to be interpreted.
Youssef  Khmou
Youssef Khmou am 9 Apr. 2013
yes the Fcn component...

Melden Sie sich an, um zu kommentieren.


DEBASISH MISHRA
DEBASISH MISHRA am 9 Aug. 2019
Hi,
You may direct use matrix 1-norms from dsp tool box.
Thanks

Community Treasure Hunt

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

Start Hunting!

Translated by