Questions tagged [r]

29 questions
10
votes
4 answers

How to perform a Rubberband-Correction on spectroscopic data?

I basicaly understood how the Rubberband/Baseline-correction works. The given spectrum is divided into (N) ranges. The lowest points in every range are determined. The initial baseline is built out of those points. Now all the points on the…
チーズパン
  • 235
  • 2
  • 8
3
votes
4 answers

Estimate peak width from a vector that is a superposition of unknown number of identical Gaussian peaks with different heights?

If you have a vector that is a superposition of an unknown number of identical Gaussian shaped peaks/impulses of unknown width (but all the same width) and different amplitudes (with Poisson or Gaussian noise), would anyone know of a method to infer…
3
votes
1 answer

How to make a Power Spectral Density Plot in R

I have a time series point process representing neuron spikes. I have computed and plotted autocovariance using acf but now I need to plot the Power Spectral Density. Power Spectral Density is defined as the Fourier Transform of the autocovariance,…
2
votes
1 answer

Finding circle in binary image (R, not matlab)

How would I extract the circular area of a binary image which looks like: The two rods emerging from the side of the circle are noise. I know of the hough transform in Matlab. However, I am using R and can't seem to find anything similar. Ideas…
Omar Wagih
  • 163
  • 5
2
votes
0 answers

Octave filtfilt converted to R code

R has a function called filtfilt that performs zero-phase digital filtering by processing the input data in both the forward and reverse directions. But it suffers from having steep transition bands. Specifically, the output signal exhibits…
2
votes
1 answer

How to Calculate the Ambiguity Function

(Maybe this should be on Stackoverflow instead ...) What is the best way to calculate the ambiguity function? There are different implementations out there for Python (like PyTFTB or from TooringAnalytics) and Matlab but there are many…
ronnyworm
  • 23
  • 4
2
votes
1 answer

Finding baseline (reference) of nosiy data and lag/lead between 2 signals

I have 2 datasets which vary with time as shown in the figure - Sa – Red , Sb – BLACK . I am doing the analysis in R. The entire dataset and a segment of data from 30 - 31 s are shown below - - As you can see from the figures, the datasets appear…
ACE
  • 21
  • 2
1
vote
1 answer

Butterworth filter's gain formula does not agree with R's `signal` package

I'm trying to calculate the Butterworth filter gain. If I use the formula mentioned on Wikipedia: $$ G^2(\omega) = \frac{G_0^2} {1+\left(\frac{j\omega}{j\omega_c}\right)^{2n}} $$ I don't get a matching result from calculating the gain directly from…
1
vote
1 answer

trying to reproduce the behavior of initial conditions for the filter delays of scipy lfilter with R

I'm trying to reproduce the behavior of lfilter and lfilter_zi (from scipy) in R (using signal package if possible). This is the example provided by scipy.signal.lfilter (I just removed a random component to be able to compare it with R) from scipy…
Bruno
  • 13
  • 2
1
vote
2 answers

Coefficient weights of Simple Moving Average (SMA) on SMA

A simple moving average (SMA: arithmetic mean) is a low-pass FIR-filter. When you cascade 2 SMA's with a window of length $n$, so when you apply the second SMA on the output of the first SMA, and you want to know which coefficient weights a filter…
1
vote
0 answers

Time spans in coherence computation

Currently I'm writing my master thesis and I'm having troubles with coherence definition. My question is similar to https://stats.stackexchange.com/questions/92412/clear-steps-to-calculate-coherence-between-two-time-series Mathematically it's…
1
vote
1 answer

Problem getting DTW to work for speech recognition

I used my ipad to record the words "This. Is. A. Test. This. Is. A. Test.", then downloaded it to my computer as a .MOV file and used ffmpeg to extract audio as WAV. I then used the tuneR package to load the WAV file into R. library(tuneR) sndObj <-…
Alex H
  • 13
  • 2
1
vote
0 answers

FFT freqency bin center in R

I'm trying to do a spectral analysis in R. I learned it in Python from Allen Downey's ThinkDSP book. What is the R equivalent of the Python numpy function, numpy.fft.fftfreq? If you provide a window length and spacing, that function returns the…
Jai Jeffryes
  • 111
  • 2
1
vote
1 answer

fft function in R vs spec function from 'seewave' package? They don't give a similar frequency spectra

I understand that spec will give me the frequency and the corresponding amplitude of that component, whereas fft will compute the DFT of the signal and throw the complex numbers for each component which I have to plot as per the physical…
1
vote
1 answer

Reproducing paper results about a wavelet transformation using python

I have been reading this PhD theis about wavelets and I am trying to reproduce some of the results but I don't know the specific code to use to generate similar results. The original time series looks like this: Then, the paper says: The customer…
Dnaiel
  • 113
  • 3
1
2