Skip to content

Instantly share code, notes, and snippets.

View thvhauwe's full-sized avatar

Thijs Van Hauwermeiren thvhauwe

View GitHub Profile
@thvhauwe
thvhauwe / awgn.jl
Created November 19, 2018 10:23
Add White Gaussian Noise (awgn) function implemented in Julia lang, to mimic the behaviour of built-in matlab function AWGN
function awgn(X,SNR)
#Assumes X to be a matrix and SNR a signal-to-noise ratio specified in decibel (dB)
#Implented by author, inspired by https://www.gaussianwaves.com/2015/06/how-to-generate-awgn-noise-in-matlaboctave-without-using-in-built-awgn-function/
N=length(X) #Number of elements in X
signalPower = sum(X[:].^2)/N
linearSNR = 10^(SNR/10)
a,b=size(X)
noiseMat = randn((a,b)).*√(signalPower/linearSNR) #Random gaussian noise, scaled according to the signal power of the entire matrix (!) and specified SNR
return solution = X + noiseMat
@thvhauwe
thvhauwe / keybase.md
Created November 8, 2018 10:18
Public identity

Keybase proof

I hereby claim:

  • I am thvhauwe on github.
  • I am thijsvh (https://keybase.io/thijsvh) on keybase.
  • I have a public key ASBYRhnWkL7vRDceJA8gkAp71lVAGvP5dgUa9oW7PP608Qo

To claim this, I am signing this object: