% This M-file converts a vector into matrix form.
% Input: y - vector
% Output: P - matrix
% P=convvect([1 0 1 0 1 0])

function P=vect2mat(y)

m=size(y,2); n=(1+sqrt(1+8*m))/2; k=1; P=zeros(n);
for i=1:n-1
    for j=i+1:n
        P(i,j)=y(k);
        P(j,i)=P(i,j);
        k=k+1;
    end
end