0
$\begingroup$

I have wrote this algorithm for steepest descent:

function [e2,w_opt]=SteepestDescent_Alg2(x,d,itr,w)
N=length(w);
sample=length(x);
x=[zeros(N-1,1); x];%padding

x1=zeros(sample,N);
for i=1:N
    x1(:,i)=x(N-(i-1):end-(i-1));
end

R=x1'*x1/sample;
P=x1'*d/sample;
lambda=eig(R);
mu=1/(min(lambda)+max(lambda));

w_opt=zeros(size(w));
dd=(d.'*d)/(sample);
e2=zeros(1,itr);
for i=1:itr
   grad=2*R*w_opt-2*P;
   e2(i)=dd+w_opt'*R*w_opt-2*P'*w_opt;
   w_opt=w_opt-mu*grad;

end
wc=R\P
end

These lines forming R:

x1=zeros(sample,N);
for i=1:N
    x1(:,i)=x(N-(i-1):end-(i-1));
end
R=x1'*x1/sample;

But if we use other way to calculating R:

function R=corlnm2(h,N)
    %This function obtains the correlation matrix of the output
    %of an FIR filter which is derived by a white noise, and its
    %coefficients are given in vector "h".
    %"N" specifies the dimensions of "R".
    %
    %   R=corlnm2(h,N)
    %j=sqrt(-1);
    a=size(h);
    if a(1)>a(2)
       h=h';
    end
    m=length(h);

    for k=1:N
        if k<=m
            R(k)=h(k:m)*h(1:m-k+1)';
        else
            R(k)=0; 
        end
    end
    R=toeplitz(R);
end

The code have written for this problem, also assume there is coloring filter with tap numerator coefficient of h:

https://www.researchgate.net/profile/Guan_Gui/publication/264457158/figure/fig4/AS:281603784888325@1444150982091/Figure-1-System-identification-using-adaptive-algorithm.png

Both two way of estimating R, getting value, really close together, but the second way gives weird learning curve. Also the input noise set to 0.1 variance, thus minimum kesi(Mean Square Error) must be 0.1, calculating R in first manner give correct learning cure(plot of MSE vs itteration) but the W's are extremely close to Wo even with more than 0.001 precision, why? And I think both way must give same answer why but this isn't ...?

$\endgroup$
  • $\begingroup$ I just hate inlined URLs. I prefer to see images if they add to the text. If they don't add to the text, don't refer to them. $\endgroup$ – Peter K. Jun 30 '17 at 12:10
  • $\begingroup$ You will find that you will get more answers with honey than with bile. Please don't be rude on this site, or any StackExchange site. Be nice $\endgroup$ – Peter K. Jun 30 '17 at 12:33
  • $\begingroup$ @PeterK. Is this post not clear? that you've gaved it down vote. $\endgroup$ – mohammadsdtmnd Jun 30 '17 at 13:11
  • $\begingroup$ @PeterK. Still not cleared? :( $\endgroup$ – mohammadsdtmnd Jul 7 '17 at 7:37
0
$\begingroup$

So let's have a look at your calculations:

x1(:,i)=x(N-(i-1):end-(i-1));

Let's say N = 10 and sample = 100 so that end = 110.

For i=1 that means we sum from 10 to 110.

For i=2 that means we sum from 9 to 109.

etc.

Comparing that with:

R(k)=h(k:m)*h(1:m-k+1)';

where m is the same as sample:

For k=1 that means we sum from 1 to 100.

For k=2 that means we sum from 2 to 99.

I think all that's happening is your first calculation is assuming x is zero-padded and the second one is assuming that it's not.

That there are differences between the two is hardly surprising, given that they are summing different (possibly random) values.

$\endgroup$
  • $\begingroup$ h Isn't sample. that is number of tap of colorizer filter, wich is colorize x(n)!? It force x(n), to not being white. I apologize since it's not mentioned ... $\endgroup$ – mohammadsdtmnd Jul 9 '17 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.