q: interpolation factor, specified as a positive integer.
n: Half the number of input samples used for interpolation, specified as a positive integer. For best results, use n no larger than 10. The low-pass interpolation filter has length 2 × n × q + 1. Default: 4.
Wc: Normalized cutoff frequency of the input signal, specified as a positive real scalar not greater than 1 that represents a fraction of the Nyquist frequency. A value of 1 means that the signal occupies the full Nyquist interval. Default: 0.5.
Returns
interpolated signal, returned as a vector.
Examples
# Generate a signalt <- seq(0,2,0.01)x <- chirp(t,2,.5,10,'quadratic')+ sin(2* pi * t *0.4)w <- seq(1,121,4)plot(t[w]*1000, x[w], type ="h", xlab ="", ylab ="")points(t[w]*1000, x[w])abline (h =0)y <- interp(x[seq(1, length(x),4)],4,4,1)lines(t[1:121]*1000, y[1:121], type ="l", col ="red")points(t[1:121]*1000, y[1:121], col ="red", pch ='+')legend("topleft", legend = c("original","interpolated"), lty =1, pch = c(1,3), col = c(1,2))