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

19 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2024-11-8,0:19
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.
  4 个评论
Amira Miora
Amira Miora 2024-11-12,20:59
thank you sir for the sugestions.
i have another question related to the function audioread(), if i use this function to read a recording
[x, fs] = audioread('recording.wav')
and then plot the signal using
plot([1:length(x)],x,'b')
the signal x is a 589251 x 2 array.
My qustion is how does MATLAB plot the signal ? by using the first column ! or the second !
here is a sample of the x signal received
-0,00894165039062500 -0,000915527343750000
-0,00827026367187500 0,000183105468750000
-0,00598144531250000 0,00180053710937500
-0,00466918945312500 0,00256347656250000
-0,00277709960937500 0,00225830078125000
-0,00109863281250000 0,00369262695312500
0,000976562500000000 0,00628662109375000
thank you
Walter Roberson
Walter Roberson 2024-11-12,21:08
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by