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
댓글 수: 0
채택된 답변
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
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 Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!