Clear Filters
Clear Filters

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

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

Accepted Answer

Sai Gokul
Sai Gokul on 12 Jul 2023
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 Comment
dabe
dabe on 26 Jul 2023
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!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!