Created
April 25, 2021 17:52
-
-
Save Athospd/41bd6da1b8c7f4b87edda3c50e4dfbd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
animation::saveGIF({ | |
f <- function(t, l = 1) (t>0)*exp(-t*l) | |
h <- function(t) as.numeric(abs(t) < 1) | |
g <- function(t, tau = seq(-2,10,l=1000)) mean(f(tau) * h(t-tau)) | |
par(mfrow = c(2,1)) | |
tau <- seq(-2,10,l=1000) | |
ts <- seq(-2,10,l=100) | |
gs <- c() | |
for(t in ts) { | |
plot(tau, h(t-tau), type = "l") | |
lines(tau, f(tau), col = "red") | |
gs <- c(gs, g(t)) | |
plot(ts[1:length(gs)], gs, xlim = range(ts), ylim = c(0,0.08), type = "l", xlab = "t", ylab = "g(t)") | |
Sys.sleep(0.1) | |
} | |
}, interval = 0.05) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment