digital-filter

How to implement band-pass Butterworth filter with Scipy.signal.butter

让人想犯罪 __ 提交于 2019-12-17 05:30:07
问题 UPDATE: I found a Scipy Recipe based in this question! So, for anyone interested, go straight to: Contents » Signal processing » Butterworth Bandpass I'm having a hard time to achieve what seemed initially a simple task of implementing a Butterworth band-pass filter for 1-D numpy array (time-series). The parameters I have to include are the sample_rate, cutoff frequencies IN HERTZ and possibly order (other parameters, like attenuation, natural frequency, etc. are more obscure to me, so any

IIR Filter Implementation in C

孤者浪人 提交于 2019-12-12 12:32:32
问题 I am trying to implement an IIR filter in C for the FRDMKL25Z board. My current code is shown below: #include "Cpu.h" #include "Events.h" #include "ADC_1.h" #include "AdcLdd1.h" #include "DAC_1.h" #include "PE_Types.h" #include "PE_Error.h" #include "PE_Const.h" #include "IO_Map.h" #define NSP 16 static uint16_t DACvalue, ADCvalue; static LDD_TError Error; static LDD_TDeviceData *MyDacPtr; int N=10; // Filter order double NumCoeff[11]={0.8017, -8.0174, 36.0785, -96.2094, 168.3664, -202.0397,

Scipy.signal crashes application made with CX_Freeze

最后都变了- 提交于 2019-12-11 06:15:00
问题 I'm trying to use butter and lfilter from scipy.signal in a compiled program. After some debugging I found that when the program reached this line: b, a = butter(order, normal_cutoff, btype='low', analog=False) The executable was closing. My program runs fine when it's in the IDE. I've put some sample code below that will re-create the problem. from scipy.signal import butter, lfilter from tkinter import * master = Tk() def test_program(): def butter_lowpass(cutoff, fs, order=5): nyq = 0.5 *

Big FFT amplitude difference between the existing (synthesized) signal and the filtered signal

徘徊边缘 提交于 2019-12-08 10:40:11
问题 I think, what amplitude in the noised regions on the FFT-plot of the filtered signal should be lower, then now. Probably, small numeric deviations/errors presented in the scipy.fftpack.lfilter() . I tried to add noise to the existing signal, but no result. Why FFT-amplitude of the filtered signal (green) in the noise regions are so high? Update: 300 dB of an FFT-amplitude are non-physical - it's clear, it's due to 64bit float in the Python-environment. FFT of the filtered signal (green) has

Converting from samplerate/cutoff frequency to pi-radians/sample in a discrete time sampled IIR filter system

徘徊边缘 提交于 2019-12-07 08:00:35
问题 I am working on doing some digital filter work using Python and Numpy/Scipy. I'm using scipy.signal.iirdesign to generate my filter coefficents, but it requires the filter passband coefficents in a format I am not familiar with wp, ws : float Passband and stopband edge frequencies, normalized from 0 to 1 (1 corresponds to pi radians / sample). For example: Lowpass: wp = 0.2, ws = 0.3 Highpass: wp = 0.3, ws = 0.2 (from here) I'm not familiar with digital filters (I'm coming from a hardware

Converting from samplerate/cutoff frequency to pi-radians/sample in a discrete time sampled IIR filter system

▼魔方 西西 提交于 2019-12-05 16:27:34
I am working on doing some digital filter work using Python and Numpy/Scipy. I'm using scipy.signal.iirdesign to generate my filter coefficents, but it requires the filter passband coefficents in a format I am not familiar with wp, ws : float Passband and stopband edge frequencies, normalized from 0 to 1 (1 corresponds to pi radians / sample). For example: Lowpass: wp = 0.2, ws = 0.3 Highpass: wp = 0.3, ws = 0.2 ( from here ) I'm not familiar with digital filters (I'm coming from a hardware design background). In an analog context, I would determine the desired slope and the 3db down point,

Circular Buffer Implementation for FIR Filter in C

半世苍凉 提交于 2019-12-02 16:35:08
问题 I am programming on an embedded microcontroller (TMS320F28069) a 32-bit floating point MCU. I was going over some of the example projects, and one of them implements a simple FIR filter on ADC sampled data. Block diagram here Let's say the ADC buffer has 10 elements. And let's say the filter has length 3 ( FILTER_LEN=3 ). The filter implementation is pretty straightforward, it starts at the end of the delay chain and moves its way to the beginning. float32 ssfir(float32 *x, float32 *a, Uint16

Circular Buffer Implementation for FIR Filter in C

爱⌒轻易说出口 提交于 2019-12-02 08:13:42
I am programming on an embedded microcontroller (TMS320F28069) a 32-bit floating point MCU. I was going over some of the example projects, and one of them implements a simple FIR filter on ADC sampled data. Block diagram here Let's say the ADC buffer has 10 elements. And let's say the filter has length 3 ( FILTER_LEN=3 ). The filter implementation is pretty straightforward, it starts at the end of the delay chain and moves its way to the beginning. float32 ssfir(float32 *x, float32 *a, Uint16 n) { Uint16 i; // general purpose float32 y; // result float32 *xold; // delay line pointer /*** Setup

calculate exponential moving average in python

浪子不回头ぞ 提交于 2019-11-27 18:02:02
I have a range of dates and a measurement on each of those dates. I'd like to calculate an exponential moving average for each of the dates. Does anybody know how to do this? I'm new to python. It doesn't appear that averages are built into the standard python library, which strikes me as a little odd. Maybe I'm not looking in the right place. So, given the following code, how could I calculate the moving weighted average of IQ points for calendar dates? from datetime import date days = [date(2008,1,1), date(2008,1,2), date(2008,1,7)] IQ = [110, 105, 90] (there's probably a better way to

High-pass filtering in MATLAB

寵の児 提交于 2019-11-27 11:03:15
Does anyone know how to use filters in MATLAB? I am not an aficionado, so I'm not concerned with roll-off characteristics etc — I have a 1 dimensional signal vector x sampled at 100 kHz, and I want to perform a high pass filtering on it (say, rejecting anything below 10Hz) to remove the baseline drift. There are Butterworth, Elliptical, and Chebychev filters described in the help, but no simple explanation as to how to implement. There are several filters that can be used, and the actual choice of the filter will depend on what you're trying to achieve. Since you mentioned Butterworth,