%% BPDN
% return noise and estimated channel

function [nmse_bp,vecH_r_bp] = BPDN_ce_no(y0,Phi,vecH_0,Atrr,noise,noi,t0)




% H_di_0 = diag(hr')*G
%hd --? Direct link

if noise
    scalar_bp =  1/norm(t0,'fro');%(4)*1e3;%2e3;
    y0 = scalar_bp*y0;
    bp_noi = scalar_bp*norm(noi,'fro');
    h_b_bp = spg_bpdn(Phi,y0,1.05*bp_noi); %% bpdn
else
    scalar_bp = 1;%1/norm(t0,'fro');%2e3;
    y0 = scalar_bp*y0;
    bp_noi = 0;
    h_b_bp = spg_bpdn(Phi,y0,1.05*bp_noi); %% bpdn
end
h_b_bp = (1/scalar_bp)*h_b_bp;
%% nmse
vecH_r_bp = Atrr*h_b_bp ;
nmse_bp =  norm(vecH_r_bp-vecH_0,'fro')^2/norm(vecH_0,'fro')^2;

end
