function [P,P1]= projection(N,M,R,M1,L)
% provides projection matrix P according to reduction factor R and ACS area 
% P1 only corresponds to the structured acquired data (without ACS area)
% 
% G. Plonka 2024

P=zeros(N,M);

if R==1              %data completely acquired
    P=ones(N,M);
elseif R==2               %each second column acquired
    P(:,1:2:end)=1;
elseif R==3           %each third column acquired
    P(:,1:3:end)=1;
elseif R==4            %each fourth column acquired
    P(:,1:4:end)=1;    
elseif R==5          %each second row and each second column acquired
    P(1:2:end,1:2:end)=1;
elseif R==6          %each second row and each third column acquired
    P(1:2:end,1:3:end)=1;
end

P1=P;   % projection matrix with structured unaquired data
%calibration area always acquired    
K1=floor(N/2)-floor((M1+L-1)/2);
K2=floor(M/2)-floor((M1+L-1)/2);
P(K1+1:K1+L+M1-1,K2+1:K2+L+M1-1) = ones(L+M1-1,L+M1-1);
end
