Code covered by the BSD License  

Highlights from
MOtion DEcision (MODE) model

image thumbnail
from MOtion DEcision (MODE) model by Massimiliano Versace
MOtion DEcision (MODE) model is a neural model of perceptual decision-making.

polyfitw.html

polyfitw.m


function [pz]=polyfitw(x,y,w)
%
% polyfitw :: Function to compute weighted least sqaures linear fits
%
%%
% w :: normalized weights
%
%% Reference
% Grossberg, S. and Pilly, P. K. (2008). Temporal dyanamics of decision-making during motion perception in the visual cortex. Vision Research, 48(12), 1345-1373.
%
%% Author
% Praveen K. Pilly (advaitp@gmail.com)
%
%% License policy
% Written by Praveen K. Pilly, Department of Cognitive and Neural Systems, Boston University
% Copyright 2009, Trustees of Boston University
%
% Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted
% without fee, provided that the above copyright notice and this permission notice appear in all copies, derivative works and
% associated documentation, and that neither the name of Boston University nor that of the author(s) be used in advertising or
% publicity pertaining to the distribution or sale of the software without specific, prior written permission. Neither Boston
% University nor its agents make any representations about the suitability of this software for any purpose. It is provided "as
% is" without warranty of any kind, either express or implied. Neither Boston University nor the author indemnify any
% infringement of copyright, patent, trademark, or trade secret resulting from the use, modification, distribution or sale of
% this software.
%
%% Last modified
% June 25, 2009

%%
pz=zeros(1,2);
n=size(x,1);

a1=0;a2=0;a3=0;a4=0;a5=0;

for j=1:n
    a1=a1+w(j)*x(j)^2;
    a2=a2+w(j)*x(j);
    a3=a3+w(j)*x(j)*y(j);
    a4=a4+w(j);
    a5=a5+w(j)*y(j);
end

pz(2)=(a3*a2-a5*a1)/(a2^2-a1*a4+eps);
pz(1)=(a3-a2*pz(2))/(a1+eps);

return

Contact us at files@mathworks.com