For loop Problem in MATLAB Code sample

3 views (last 30 days)
Ahmad Bilal
Ahmad Bilal on 29 Jan 2018
Hello to all: I have came across one MATLAB code that calculates Direction of Arrival for microphone pair with help of LMS Algorithm. In the beginning of code i am facing one problem in for loop. Code snipet is as follows:
*fs=44100; % Sampling frequency (Hz) d_micro=0.1; % Distance between microphones (m) c=340; % Speed of sound (m/s) Nmax =ceil(d_micro*fs/c); % Maximum number of samples Nmax
DESP=ceil(Nmax*1.5); %Delay we insert in the micro 2 % We leave 50% of margin of error
lengData=44100*0.5; % Number of samples in which the voice is processed
signal1=audioread('90.wav')'; % Importing the file to process.
length(signal1); % Now for loop
for k=lengData:lengData:length(signal1)
signal=signal1(1,k-(lengData-1):k); % Signal in MIC B d=signal1(2,k-(lengData-1):k); % Signal in MIC A
I have question that how this for loop works as lengData comes out to be 22050 and length(signal1) is 8272.
this means for k =22050:22050:8272 how is that possible? can anybody help me regarding this?? Thank you

Answers (0)

Community Treasure Hunt

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

Start Hunting!