Exponential decay is a simple mathematical model yet very effective in modeling real-world signal behavior in many areas of Natural Science such as Radioactivity, Vibrations, Chemical Reactions, Geophysics, and etc.
This simple Shiny App was developed for users who want to learn about the exponential decay model, its key parameters, and how the key parameters alter the signal.
Additionally, the Shiny App enables the users to show prediction and its 95% confidence interval estimated from the nonlinear regression model.
Normalized signal equation is written in the following form:
\[S(t) = exp(-\frac{t}{\lambda}) + \epsilon\]
where \(S(t)\) is the normalized signal intensity (a.u.), \(t\) is time (s), \(\lambda\) is the Decaying Time Constant (s), and \(\epsilon\) is random noise.
df<-data.frame(t = t, s = s); par(mar=c(4,4,0,0))
fit<-nls(s ~ exp(-t/lambda), data = df,start = list(lambda=35.0))
sfit<-predict(fit,list(t=df$t))
plot(t,s, xlab="Time (s)", ylab = "Signal Intensity (a.u.)", col="black")
lines(t,sfit,lwd=3,col="red")
legend("topright", legend=c("Data", "Nonlinear Fit"), col=c("black", "red"), pch=c(1,-1), lty=c(0,1))
## [1] "True lambda: 50 (s)"
## [1] "Predicted lambda: 48.64"
## [1] "Relative Error: -3 %"
Here is the weblink to a very simple R shiny app that performs the nonlinear exponential fitting.