function modelmat=creatcontmodel(euclidean) th=linspace(-pi,pi,17); th=th(1:end-1); [x,y]=pol2cart(th',1); % draw unit circle in Cartesian coords xy=[x y]; % cat for easier indexing below for a=1:length(th) for b=1:length(th) if euclidean==0 modelmat(a,b)=(abs(angdiff(th(a),th(b)))/pi); %angular elseif euclidean==1 modelmat(a,b)=norm(xy(a,:) - xy(b,:)); %euclidean end end end % figure;imagesc(modelmat); end