signal-processing

Find time shift of two signals using cross correlation

假装没事ソ 提交于 2020-06-10 05:12:09
问题 I have two signals which are related to each other and have been captured by two different measurement devices simultaneously. Since the two measurements are not time synchronized there is a small time delay between them which I want to calculate. Additionally, I need to know which signal is the leading one. The following can be assumed: no or only very less noise present speed of the algorithm is not an issue, only accuracy and robustness signals are captured with an high sampling rate (>10

Find time shift of two signals using cross correlation

流过昼夜 提交于 2020-06-10 05:11:09
问题 I have two signals which are related to each other and have been captured by two different measurement devices simultaneously. Since the two measurements are not time synchronized there is a small time delay between them which I want to calculate. Additionally, I need to know which signal is the leading one. The following can be assumed: no or only very less noise present speed of the algorithm is not an issue, only accuracy and robustness signals are captured with an high sampling rate (>10

How to run n points FFT in R?

那年仲夏 提交于 2020-05-16 05:57:09
问题 Suppose I have a length 100 vector x, in Matlab , I can run fft(x,32) to get a length 32 complex vector. But how to do it in R ? fft(x,32) will not work and will still return a length 100 complex vector. 回答1: From MatLab documentation: Y = fft(X,n) returns the n-point DFT. If no value is specified, Y is the same size as X. If X is a vector and the length of X is less than n, then X is padded with trailing zeros to length n. If X is a vector and the length of X is greater than n, then X is

How to run n points FFT in R?

心已入冬 提交于 2020-05-16 05:56:07
问题 Suppose I have a length 100 vector x, in Matlab , I can run fft(x,32) to get a length 32 complex vector. But how to do it in R ? fft(x,32) will not work and will still return a length 100 complex vector. 回答1: From MatLab documentation: Y = fft(X,n) returns the n-point DFT. If no value is specified, Y is the same size as X. If X is a vector and the length of X is less than n, then X is padded with trailing zeros to length n. If X is a vector and the length of X is greater than n, then X is

Can I convert spectrograms generated with librosa back to audio?

 ̄綄美尐妖づ 提交于 2020-05-15 06:38:27
问题 I converted some audio files to spectrograms and saved them to files using the following code: import os from matplotlib import pyplot as plt import librosa import librosa.display import IPython.display as ipd audio_fpath = "./audios/" spectrograms_path = "./spectrograms/" audio_clips = os.listdir(audio_fpath) def generate_spectrogram(x, sr, save_name): X = librosa.stft(x) Xdb = librosa.amplitude_to_db(abs(X)) fig = plt.figure(figsize=(20, 20), dpi=1000, frameon=False) ax = fig.add_axes([0, 0

Intelligent Peak Detection Method

余生长醉 提交于 2020-05-08 04:38:40
问题 I would like to detect the peaks from this data using python: data = [1.0, 0.35671858559485703, 0.44709399319470694, 0.29438948200831194, 0.5163825635166547, 0.3036363865322419, 0.34031782308777747, 0.2869558046065574, 0.28190537831716, 0.2807516154537239, 0.34320479518313507, 0.21117275536958913, 0.30304626765388043, 0.4972542099530442, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0

Matlab's bandpass filter equivalent in python

Deadly 提交于 2020-04-18 03:49:26
问题 In matlab there is a function called bandpass that I often use. The doc of the function can be found here: https://ch.mathworks.com/help/signal/ref/bandpass.html I am looking for a way to apply a bandpass filter in Python and get the same or almost the same output filtered signal. My signal can be downloaded from here: https://gofile.io/?c=JBGVsH Matlab code: load('mysignal.mat') y = bandpass(x, [0.015,0.15], 1/0.7); plot(x);hold on; plot(y) Python code: import matplotlib.pyplot as plt import

Step detection in one-dimensional data

こ雲淡風輕ζ 提交于 2020-02-17 08:00:31
问题 Is there an existing implementation in Python for detecting steps in one dimensional data? E.g. something that detects one step in this data: There are quite a few descriptions of algorithms out there but I am wondering if something suited for the job exists in Python? I'm not sure if/how I should provide that data but here it is: [ 594. 568.55555556 577.22222222 624.55555556 546.66666667 552.88888889 575.55555556 592.33333333 528.88888889 576.11111111 625. 574.22222222 556.33333333 567

points of intersection of horizontal line with a function [duplicate]

烂漫一生 提交于 2020-01-26 04:46:25
问题 This question already has answers here : Intersection of two graphs in Python, find the x value (8 answers) Closed 8 months ago . i have this code that generate the following (image), how would i proceed to detect the intersections of the line with the function ?` import numpy as np import matplotlib.pyplot as plt y = 0.4*np.ones(100) x = np.arange(0, 100) t = np.linspace(0,100,100) Fs = 6000 f = 200 func = np.sin(2 * np.pi * f * t / Fs) idx = np.where(func == y) # how i think i should do to

How to filter a stream of data

走远了吗. 提交于 2020-01-25 07:58:39
问题 Im trying to implement a filter for sensor readings on a Raspi. I get a constant stream of data from the sensors that I want to filter using my filter code. I tried to emulate the sort of readings I would get from a sensor by generating random numbers in my rangen code. The issue is that for some reason I cannot see any output from the filter and I dont even know if it works. Below are the codes for generating a random stream of data and the filter. Am I emulating the sensor readings right?