why does the aasamplebiasedautoc is giving abnormal results with a noise signal?

1 vue (au cours des 30 derniers jours)
Greetings everyone
In order to find the eigenvalues of correlation matrix Rx from an input signal x(n), i used the Book
m-function: rx = aasamplebiasedautoc(x,M) with M is the digital filter order. the function gives good results with both sinus and random signal (randn) data, but when i applied it to a noise recording signal by using the function : audioread(....), it starts giving abnormal results. i respected all the vectors' dimensions but sill can't find the problem.
here is the of the Book m-function i used :
function[r]=aasamplebiasedautoc(x,lg)
%function[r]=aasamplebiasedautoc(x,lg);
%this function finds the biased autocorrelation function
%with lag from 0 to lg;it is recommended that lg is 20-30% of
%N;
N=length(x);%x=data;lg=lag;
for m=1:lg
for n=1:N+1-m
xs(m,n)=x(n-1+m);
end;
end;
r1=xs*x'
sz3 = size(r1)
r=r1'./N;
the size of the data vector is 2 589251
thanks for your attention

Réponse acceptée

Walter Roberson
Walter Roberson le 8 Nov 2024
That code expects a vector of input as the first parameter. You are sending in a 2D array. The way your data is arranged, the code is going to take samples alternating between row 1 and row 2 -- row1column1 row2column1 row1column2 row2column2 row1column3 row2column3 and so on.
If you were to send in a 589251 x 2 array, where the number of rows exceeded the number of columns, then the code would effectively only work on the first column -- but when the number of columns exceeds the number of rows, the samples are going to be taken alternately.
  5 commentaires
Walter Roberson
Walter Roberson le 12 Nov 2024
plot([1:length(x)],x,'b')
will use 1:length(x) as the independent coordinate of the plot.
It will notice that this is a vector, and will match the length of the vector to the size() of the 2D array that is the dependent coordinate. First it will test the length against the size of the first dimension of the dependent coordinate. As it will find a match in sizes, it will plot one line for each column in the dependent coordinate. The result will be equivalent to
plot(1:length(x), x(:,1), 'b', 1:length(x), x(:,2), 'b')
If it detected a mismatch of sizes of the first dimension of the dependent coordinate, it would check the second dimension of the dependent coordinate; if it found a match, it would plot one line for every row of the dependent coordinate.
If the length of the independent coordinate does not match the first or second dimension of the dependent coordinate, then it would give up with a size error.
Amira
Amira le 28 Nov 2024
Modifié(e) : Amira le 29 Nov 2024
Thank you sir.
i figured the problem. it was related to the fact that my audios are in dual channel (stereo) and not single channel.
thanks for your help

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by