2

I am trying to implement the following system in MATLAB. I am reading an audio signal and want to perform the operation below.

enter image description here

so far I have done the following:

%read the audio file
[y,Fs] = audioread('input_original.wav');

syms k x
yx = symsum(k, k, -inf, y);

%write the output
audiowrite('signal_divbb.wav',yx,Fs,'BitsPerSample',64)

is there a way to implement this signal properly? I am not familiar with MATLAB

Arnold Asllani
  • 155
  • 1
  • 12
  • Since it is already answered I just want to point out here, the difference between the theory and implementation is that you cannot talk about `inf` of a finite-time signal, which is recorded and stored on the disk as a finite-sized file. – Yvon Mar 10 '17 at 22:42
  • so the value at n will be the running sum from index 1 until n? – Arnold Asllani Mar 10 '17 at 22:46
  • Assuming the first index as `-Inf`, yes. – Yvon Mar 10 '17 at 22:48

1 Answers1

4

The output of audioread (your y variable) has m rows times n columns, where m is the signal length and n is the number of channels (2 for stereo). You can use cumsum as follows:

yx = cumsum(y, 1);

This computes the cumulative sum along the first dimension (i.e. time). So yx(k,c) equals y(1,c)+y(2,c)+...+y(k,c), where k ranges from from 1 to m, and c is the channel index from 1 to n.

Luis Mendo
  • 110,752
  • 13
  • 76
  • 147