How to change the dimension of a signal from 1000x1 to 1x1?

4 次查看(过去 30 天)
Hello together,
I have built a Voice Activity Detector which works relatively well. In the scope I can derive the envelope and the resulting on/off decision.
Unfortunately the dimension of the binary signal does not match the adapt input of the NLMS block.
How can I change the dimension of the signal without changing the behavior?
What I have tried:
- Switch Threshold with Constant 1 and 0 (Dimensions stays the same).
- Logic Decision (Dimension stays the same)
- Logic AND with 1 (Dimension stays the same)
Thanks in advance!
Best regards
Daniel

采纳的回答

Sai Gokul
Sai Gokul 2023-7-12
Hi Dabe,
I understand that you want to change the dimension of a binary signal from 1000X1 to 1X1
Here is an approach you can follow:
  • Add a MATLAB Function block to your SIMULINK model.
  • Double-click on the MATLAB Function block to open the MATLAB editor.
  • In the MATLAB editor, define the function as follows:
function y = changeDimension(u)
y = sum(u);
end
This function takes the input signal u and sums all its elements, effectively changing the dimension from 1000X1 to 1X1.
  • Save the MATLAB Function block and close the MATLAB editor.
  • Connect the output of your Voice Activity Detector to the input of the MATLAB Function block.
  • Connect the output of the MATLAB Function block to the adapt input of the NLMS block.
You can refer to the documentation below to understand more about the MATLAB Function block :
Hope this helps!
  1 个评论
dabe
dabe 2023-7-26
Hi Sai Gokul,
thank you for your answer and excuse my late response.
I tried your suggestion and it works with a little change. Due to the fact that the sum will create a amplitude of 1000 it had to be multiplied by 0.001.
function y = changeDimension(u)
y = 0.001*sum(u);
end
Thank your very much!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Block Libraries 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by