[Numpy-discussion] help with translating some matlab

Neal Becker ndbecker2 at gmail.com
Fri Feb 18 11:04:45 EST 2011


I got the following matlab code from a colleage:

initialization:

h =zeros(1, N);  %%  initial filter coefficients
lambda =1;
delta =0.001;

P =eye(N)/delta;

loop:

z =P*(x1');

g =z/(lambda+ x1*z);

y = h*x1';  %% filter output

e = ph_cpm_out(n) - y; %% error

h = h + e*g';   %% adaptation

Pnext=(P-g*z')/lambda;

P =Pnext;

So it looks to me:
z is a vector

The step g=z/(lambda+x1*z) seems to be a vector division.
How do I translate this to numpy?




More information about the NumPy-Discussion mailing list