data(KH)
sig = KH$JSTR[[1]]
#### reduce samples from 125 (0.008) to 25Hz (0.04)
newdt = KH$dt[1]*5
sig2 = downsample(sig, dt = KH$dt[1], newdt = newdt )
L0 = length(sig)
L1 = length(sig2)
op <- par(no.readonly = TRUE)
par(mfrow=c(2,1) )
plot.ts(ts(sig, deltat=KH$dt[1] ), xlab='s',
ylab='Amplitude', main=paste('Orignal', L0) )
grid()
plot.ts(ts(sig2, deltat=newdt ), xlab='s',
ylab='Amplitude', main=paste('Downsample', L1) )
grid()
par(op)
Run the code above in your browser using DataLab