
  clear all

  m = 101;
  p = 1e+3;
  P = 1:p;
  ell = 75;
  tol = 1e-14;
  h = 1/(m-1);
  t = 0:h:1;
  
  params = rand(p,ell);
  for i = 1:m
    for j = 1:ell
      Y(i,j) = sin(2*pi*P*t(i))*params(:,j);
    end
  end

  [Qs,Rs,Ps] = qr(Y); 
  Qst = Qs';
  [rsize,csize] = size(Qst);

%  clear params Rs Ps 
  for k = 1:p
      B(:,k) = Qst*sin(2*pi*t'*(k-1));
  end
  [Qnew,Rnew] = qr(B);
  rank(Qnew) 

  [Us,Ss,Vs] = svd(B);
  rank(Qs,tol)
  rank(Ss,tol)

  


