%% do the same problem with LMS
load fish.mat; 
close all
rho = rho - mean(rho); 
stim = stim - mean(stim);
flen = 500; 
trn = floor(length(rhoLP)*0.66667); 
h = adaptfilt.lms(flen, 0.008); 
[y, e] = filter(h, rho(1:trn), stim(1:trn)); %%train on only the first 2/3 of the data. 
plot(h.coefficients); 
figure
y = filter(h.coefficients, 1, rho); 
e = stim - y; 
plot(time, stim, 'r'); 
hold on
plot(time, y, 'b'); 
mselmst = mean(e(1:trn).^2); 
mselmsp = mean(e(trn:end).^2); 
title(sprintf('red=stim, blue=recon, mse(train)=%3.1f, mse(predict)=%3.1f', mselmst, mselmsp))
xlabel('time, ms')