# NOT RUN {
# FHT of a 2.5 Hz signal with offset
fs <- 100
secs <- 10
freq <- 2.5
t <- seq(0, secs - 1 / fs, 1 / fs)
x <- 5 * t + 50 * cos(freq * 2 * pi * t)
X <- fht(x)
op <- par(mfrow = c(2, 1))
plot(t, x, type = "l", xlab = "", ylab = "", main = "Signal")
f <- seq(0, fs - (1 / fs), length.out = length(t))
to <- which(f >= 5)[1]
plot(f[1:to], X[1:to], type = "l", xlab = "", ylab = "",
main = "Hartley Transform")
par(op)
# }
Run the code above in your browser using DataLab