function [ noise ] = addnoise( y,SNR,N )
%%Function addnoise() is to generate noise with desired SNR

nois = randn(N,1);
y_power=sum((y).^2)/N;
n_power=sum((nois).^2)/N;
scale=(y_power*10^(-(SNR)/10))/n_power;
noise=sqrt(scale)*nois;
pownn=sum((noise).^2)/N;
SNRin=10*log10(y_power/pownn);



end