Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/spectral_methods.R

This function compares the performance of `InstantaneousFrequency`

against signals of known instantaneous frequency.
The known signal is of the form

*a * \sin(omega_1 + phi_1) + b * sin(omega_2 + phi_2) + c*

One can create quite complicated signals by choosing the various amplitude, frequency, and phase constants.

1 2 3 4 |

`tt` |
Sample times. |

`method` |
How the numeric instantaneous frequency is calculated, see |

`lag` |
Differentiation lag, see the |

`a` |
Amplitude coefficient for the first sinusoid. |

`b` |
Amplitude coefficient for the second sinusoid. |

`c` |
DC shift |

`omega.1` |
Frequency of the first sinusoid. |

`omega.2` |
Frequency of the second sinusoid. |

`phi.1` |
Phase shift of the first sinusoid. |

`phi.2` |
Phase shift of the second sinusoid. |

`plot.signal` |
Whether to show the time series. |

`plot.instfreq` |
Whether to show the instantaneous frequencies, comparing the numerical and analytical result. |

`plot.error` |
Whether to show the difference between the numerical and analytical result. |

`new.device` |
Whether to open each plot as a new plot window (defaults to |

`...` |
Plotting parameters. |

For a description of how the exact analytical frequency is derived, see http://www.unc.edu/%7Ehaksaeng/hht/analytic_instantaneous_freq.pdf

`instfreq$sig` |
The time series |

`instfreq$analytic` |
The exact instantaneous frequency |

`instfreq$numeric` |
The numerically-derived instantaneous frequency from |

Daniel C. Bowman [email protected]

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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ```
#Simple signal
tt <- seq(0, 10, by = 0.01)
a <- 1
b <- 0
c <- 0
omega.1 <- 30 * pi
omega.2 <- 0
phi.1 <- 0
phi.2 <- 0
PrecisionTester(tt, method = "arctan", lag = 1, a, b, c,
omega.1, omega.2, phi.1, phi.2)
#That was nice - what happens if we use the "chain" method...?
PrecisionTester(tt, method = "chain", lag = 1, a, b, c,
omega.1, omega.2, phi.1, phi.2)
#Big problems! Let's increase the sample rate
tt <- seq(0, 10, by = 0.0005)
PrecisionTester(tt, method = "chain", lag = 1, a, b, c,
omega.1, omega.2, phi.1, phi.2)
#That's better
#Frequency modulations caused by signal that is not symmetric about 0
tt <- seq(0, 10, by = 0.01)
a <- 1
b <- 0
c <- 0.25
omega.1 <- 2 * pi
omega.2 <- 0
phi.1 <- 0
phi.2 <- 0
PrecisionTester(tt, method = "arctan", lag = 1, a, b, c,
omega.1, omega.2, phi.1, phi.2)
#Non-uniform sample rate
set.seed(628)
tt <- sort(runif(500, 0, 10))
a <- 1
b <- 0
c <- 0
omega.1 <- 2 * pi
omega.2 <- 0
phi.1 <- 0
phi.2 <- 0
PrecisionTester(tt, method = "arctan", lag = 1, a, b, c,
omega.1, omega.2, phi.1, phi.2)
``` |

hht documentation built on May 29, 2017, 9:26 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.