diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000000000000000000000000000000000000..1777ccd3ed25b28790cf8639a3f8f39d738e7898 --- /dev/null +++ b/Project.toml @@ -0,0 +1,6 @@ +[deps] +DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" +DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" +FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" +FourierTools = "b18b359b-aebc-45ac-a139-9c0ccbb2871e" +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" diff --git a/frequency_power.jl b/frequency_power.jl new file mode 100644 index 0000000000000000000000000000000000000000..9282b7ff80a4b56c7951d62c52022917d8dc6f95 --- /dev/null +++ b/frequency_power.jl @@ -0,0 +1,16 @@ +using Pkg; Pkg.activate("."); +using FFTW, DSP, Plots, DelimitedFiles + +function plot_spectogram(s, n=div(length(s),8), noverlap=div(n,2)) + spec = spectrogram(s, n, noverlap) + heatmap(spec.time, spec.freq, spec.power) +end + +function read_data(dataname, gyro=false) + if !gyro + return readdlm("data/$(dataname)_acc.txt", Float64) + else + return (readdlm("data/$(dataname)_acc.txt", Float64), + readdlm("data/$(dataname)_gyr.txt", Float64)) + end +end