Skip to content

Lightbridge-KS/simWaves

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simWaves

Lifecycle: experimental

An R-package for Simulating Waveform to a Data Frame

Installation

You can install the development version of simWaves from GitHub with:

# install.packages("devtools")
devtools::install_github("Lightbridge-KS/simWaves")

Simulate Trigonometric Waves

library(simWaves)

Basic Sinusoid Waves

sim_sinusoid will simulate any waves from a given function (e.g. trigonometric functions).

Let’s start with 1 sine wave.

# Simulate to a data frame
df1 <- sim_sinusoid("sin", n = 1)
# Plot
plot(df1, type = "l")

Now, I’ll change simulating function to cos with wavelength 2 and amplitude 3.

df2 <- sim_sinusoid("cos", lambda = 2, amp = 3)
plot(df2, type = "l")

Sinusoid Waves + Linear Models

You can use sim_sinusoid_lm() to simulate sinusoidal wave, also, add linear model ontop.

Let’s create 10 sine waves plus linear model with slope 1 and some random error.

df3 <- sim_sinusoid_lm("sin", n = 10, slope = 1, epsilon_sd = 0.1, by = 0.01)
plot(df3, type = "l")

About

R 📦 for Simulate Waveform data

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages