postscript(file="sim/jitter3.ps", horizontal=FALSE) derivate<-function(what) { res=filter(c(what[1],what,what[length(what)]), c(1,0,-1), method="convolution", sides=2)/2 res=na.omit(res) return (res) } i<-read.table("sim/rx_response.data") start=500 end=700 sample=25 #ns points=2000 t<-i$V1[start:end]/1e-9 edge<-i$V3[start:end] zero_crossing=approx(edge, t, 0, method="linear")$y zero_crossing t=t-zero_crossing split.screen(c(3,1)) plot(edge, t, type="l", xlab="Voltage", ylab="time [ns]") sampling=approx(t,edge, sample, method="linear")$y points(c(0,sampling), c(0,sample)) text(c(0,sampling+0.15), c(10,sample), labels=c("Zero\ncrossing","Sampling\npoint\n@25ns"), cex=0.6) quantile=qnorm(1e-9) quantile deviation=sampling/quantile range=0.9891 deviation=deviation*range^2 points( rnorm(points, sd=deviation), runif(points, min=min(t), max=-5) ,pch=20 ) x=seq(min(edge), max(edge), length=500) lines(x, dnorm(x, sd=deviation)*max(t)/dnorm(0, sd=deviation)) screen(2) plot(t,edge, type="l", ylim=c(-1.2, 1.2), xlab="Time offset from edge crossing zero [ns]", ylab="Voltage or probability (uncalibrated)", xlim=c(-20,20)) text(0,-1,labels=paste("range=",range*100,"%")) dist=pnorm(-edge, sd=deviation) m=max(dist) i=which.max(dist) dist[i:length(dist)]=m dist=c(dist,rep(m,length(t))) lines(t,dist[1:length(t)]) dens=derivate(dist) dens=dens[1:length(t)] lines(t,dens/max(dens)) off=length(dens)-which.max(dens) dist2=convolve(dist, dens, type="open") dist2=dist2[off:length(dist2)] dist2=convolve(dist2, dens, type="open") dist2=dist2[off:(off+length(t)-1)] dens2=derivate(dist2) lines(t,dist2) lines(t,dens2/max(dens2)) screen(3) plot(t,log(1-dist[1:length(t)])/log(10), type="l", xlab="Time offset from edge crossing zero [ns]", ylab="log(1-Distribution function of jitter)") lines(t,log(1-dist2)/log(10)) dist=dist[1:length(t)] p=approx(t, dist, 25, method="linear") points(p$x, log(1-p$y)/log(10), pch="+") text(p$x+6,log(1-p$y)/log(10)+2,labels=1-p$y) p=approx(t, dist2, 25, method="linear") text(p$x+6,log(1-p$y)/log(10)+3,labels=1-p$y) points(p$x, log(1-p$y)/log(10), pch="+")