why does the aasamplebiasedautoc is giving abnormal results with a noise signal?
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Amira Miora
el 7 de Nov. de 2024 a las 23:14
Comentada: Walter Roberson
el 12 de Nov. de 2024 a las 21:08
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
0 comentarios
Respuesta aceptada
Walter Roberson
el 8 de Nov. de 2024 a las 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 comentarios
Walter Roberson
el 12 de Nov. de 2024 a las 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!