Skip to content
Snippets Groups Projects
Commit 664b3848 authored by Rivnyák Tímea's avatar Rivnyák Tímea
Browse files

recursive LSQ

parent 0efcb9d8
Branches
No related tags found
No related merge requests found
function [theta, p] = recursiveLSQ(phi, y, lambda0, alpha)
p = zeros(size(phi));
p(1, :) = reshape(pinv(sum(alpha * phi .* phi)), [], size(phi, 2));
theta = zeros(size(phi));
theta(1, :) = p(1) .* sum(alpha * phi .* y, 1);
lambda = zeros(size(phi, 1), 1);
lambda(1) = lambda0;
for t = 2:size(phi, 1)
lambda(t) = lambda0 * lambda(t-1) + 1 - lambda0;
p(t, :) = 1/lambda(t) * (p(t-1, :) - (p(t-1, :) .* phi(t, :) .* phi(t, :) .* p(t-1, :))./((lambda(t)/alpha)+phi(t, :) .* p(t-1, :) .* phi(t, :)));
theta(t, :) = theta(t-1, :) + alpha * p(t, :) .* phi(t, :) .* (y(t)-phi(t, :) .* theta(t-1, :));
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment