t <- seq(0, 1, length.out = 100)
# Generate Fourier basis
phi_fourier <- eFun(t, M = 5, type = "Fourier")
matplot(t, phi_fourier, type = "l", lty = 1,
main = "Fourier Eigenfunctions", ylab = expression(phi(t)))
# Generate Wiener eigenfunctions
phi_wiener <- eFun(t, M = 5, type = "Wiener")
matplot(t, phi_wiener, type = "l", lty = 1,
main = "Wiener Eigenfunctions", ylab = expression(phi(t)))
# Check orthonormality (should be identity matrix)
dt <- diff(t)[1]
gram <- t(phi_fourier) %*% phi_fourier * dt
round(gram, 2)
Run the code above in your browser using DataLab