Arnold Asllani
Arnold Asllani

Reputation: 155

Matlab signal implementation

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

Upvotes: 2

Views: 81

Answers (1)

Luis Mendo
Luis Mendo

Reputation: 112659

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.

Upvotes: 4

Related Questions