function modelmat=creat_u_d_model th=linspace(0,2*pi,17); th=th(1:16); for a=1:length(th) for b=1:length(th) dife=(abs(angdiff(th(a),th(b)))); %minor difference since we are using euclidean distance m0(a,b)=abs((angdiff(th(a),th(b)))); %minor difference since we are using euclidean distance if th(a)>=0.5*pi&th(a)<1.5*pi if th(b)>=0.5*pi&th(b)<1.5*pi modelmat(a,b)=0; else modelmat(a,b)=1; end else if th(b)>=0.5*pi&th(b)<1.5*pi modelmat(a,b)=1; else modelmat(a,b)=0; end end end end end