#Prepare Data
n = 1000
x = seq(-pi,pi,length.out=n)
y = sin(x) + (runif(length(x))*0.1) #NOISY DATA
ys = smth(y,window = 0.1,method = "gaussian") #SMOOTHING
plot(x,y,type="l",col="red")
lines(x,ys,col="black",lwd=3)
title("Example Smoothing of Noisy Data")
Run the code above in your browser using DataLab