
function H = hdata(y1,ym)

                [u,s,v] = svd(y1);    
                
                y1t = y1*v;
                ymt = ym*v;
             
                p =  size(y1t,1);
                G1t = y1t(:,1:p);
                Gyt = ymt(:,1:p);
                
                Ftilde = ymt(:,p+1:end);
                
                
                n=rank(Ftilde*Ftilde');
                
               [u,s,v] = svd(Ftilde*Ftilde');

                u = u(:,1:n);
                s = s(1:n,1:n);
                v = v(:,1:n);
                
                    for i = 1:size(diag(s))
                        s(i,i) = s(i,i)^-1;
                    end
                    
                Finv = v*s'*u';
                
                
             Htemp = Finv*Gyt*pinv(Gyt'*Finv*Gyt)*G1t';
             H=Htemp';
end