Description Usage Arguments Details Value See Also Examples
Functions used to reveal directional and scale information with 2D KZ periodograms for spatial motions covered by heavy noises.
One can get 2D raw periodogram with function kzp2
, and smooth the
2D periodogram with function smooth.kzp2
.
Function summary.kzp2
can help to summarize direction and frequency
information from smoothed 2D KZ periodogram. The input should be a 2D KZ
periodogram data with frequency range (0, 0.5] on both x- and y- axis.
1 2 3 4 5 | kzp2(x, k = 1, m = dim(x)/k, ...)
smooth.kzp2(rpg, dpct = 0.01, w = round(dim(rpg)/4), k = 1, ...)
kzp2.summary(spg, rg.x, rg.y, num = 10)
|
x |
Data array of 2D wave field. Missing values are allowed. Limited to 2D arrays for current version. |
k |
The number of iterations for the KZFT. Default is 1. |
m |
The window size for a regular Fourier transform. Default value is set to data array size. |
... |
Arguments to be passed to methods.
|
rpg |
Array of raw 2D periodogram. Usually it is part of output of |
dpct |
A pre-specified percentage of total variation. Default value is 1%. |
w |
Smoothing window size. |
spg |
Array of smoothed 2D periodogram. It could be output of |
rg.x |
Frequency range for x direction. Defaults to c(0, 0.5). |
rg.y |
Frequency range for y direction. Defaults to the same value of the range for x direction. |
num |
Wave numbers. Defaults to 10. |
KZ 2D raw spectrum is calculated based on kz.ft
.
The smoothing method is an extension of kzft::smooth.kzp
.
See introduction of DZ method in kzft::smooth.kzp
for more
information.
Returned value of function kzp2
is a data list of
periodogram information, including data array kzp2d for 2D
periodogram values, and two frequency vectors, freq.x and
freq.y for x and y direction, respectively.
smooth.kzp2
only outputs the array of smoothed values.
kzp2.summary
returns a data list for suggested wave
parameters, including frequency and direction values.
kzpdr
, kzpdr.eval
, kzpdr.spikes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | dx <- 100 # x range
dy <- 120 # y range
b <- expand.grid(x=1:dx, y=1:dy)
q1 <- pi/6; f1 <- 0.2;
b$v1 <- sin(f1*2*pi*(b$x*cos(q1)+b$y*sin(q1))+100*runif(1))
q2 <- pi/4; f2 <- 0.08;
b$v2 <- sin(f2*2*pi*(b$x*cos(q2)+b$y*sin(q2))+100*runif(1))
a <- array(0,c(dx,dy))
a[as.matrix(b[,1:2])] <- b$v1 + 1.5*b$v2
a <- a + 10*matrix(rnorm(dx*dy,0,1),ncol=dy)
rp <- kzp2(a) # raw 2D spectrum
fy <- rp$freq.y; fx <- rp$freq.x; rp <- rp$kzp2d
# smoothing 2D spectrum 2 times
sp <- smooth.kzp2(rp,0.01,k=2)
par(mfrow=c(2,1), cex=0.5)
persp(x=fx, y=fy, z=rp, expand =0.5,
main = "Raw 2D KZ Periodogram", ltheta=40, shade=0.75,
theta=-30, phi=15, zlab="",xlab="x", ylab="y",
ticktype="detailed", col="lightblue")
persp(x=fx, y=fy, z=sp, expand =0.5,
main = "Smoothed 2D KZ Periodogram", ltheta=40, shade=0.75,
theta=-30, phi=25, zlab="",xlab="x", ylab="y",
ticktype="detailed", col="lightblue")
par(mfrow=c(1,1), cex=1)
kzp2.summary(sp) # direction & frequency
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.