require(reshape2)
require(ggplot2)
# \donttest{
# drop the first row and first column because of divergence on Laplace Transform
x = seq(0, 2, length.out=50)[2:50]; y = seq(0, 2, length.out=50)[2:50];
# do kimesurface transform on sine function
z2_grid = kimesurface_transform(FUNCT = function(t) { sin(t) },
real_x = x, img_y = y)
time_points = seq(0+0.001, 2*pi, length.out = 160)
inv_data = inv_kimesurface_transform(time_points, z2_grid)
time_Intensities_ILT_df2 <- as.data.frame(cbind(Re=scale(Re(inv_data$Smooth_Reconstruction)),
Im=scale(Re(inv_data$Raw_Reconstruction)),
fMRI=scale(Re(sin(time_points))),
time_points=time_points))
colnames(time_Intensities_ILT_df2) = c("Smooth Reconstruction",
"Raw Reconstruction",
"Original sin()",
"time_points")
df = reshape2::melt(time_Intensities_ILT_df2, id.var = "time_points")
ggplot(df, aes(x = time_points, y = value, colour = variable)) +
geom_line(linetype=1, lwd=3) +
ylab("Function Intensity") + xlab("Time") +
theme(legend.position="top")+
labs(title= bquote("Comparison between" ~ "f(t)=sin(t)" ~ "
and Smooth(ILT(LT(fMRI)))(t); Range [" ~ 0 ~":"~ 2*pi~"]"))
# }
Run the code above in your browser using DataLab