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!