function Z_select = Z_select_init(Z,n)
%initial data for all
f_0 = ID_EQ(Z);
[Nx, Nv, Nz] = size(f_0); N = Nx*Nv;
f_0 = reshape(f_0,N,Nz);

%first z_1
[select_i, ~] = Max_L2(f_0);
f_0_select = zeros(N,n);
Z_select = zeros(n,1);

for i = 1:n
    f_0_select(:,1:i) = Orthogonal([f_0_select(:,1:i-1), f_0(:,select_i)]);
    f_0(:,select_i) = [];
    Z_select(i,:) = Z(select_i,:);
    Z(select_i,:) = [];
    %Get the next basis
    if i ~= n
    [select_i,~] = Max_Proj(f_0,f_0_select(:,1:i+1));
    end
end







