简体   繁体   English

Python中的不规则采样频率到规则采样频率

[英]Irregular sample frequency to regular sample frequency in Python

Example:例子:

x1 = [0.0, 0.3, 0.8, 1.1]

y1 = [5, 6 , 4, 1]

period = 0.4

To:到:

x2 = [0.0, 0.4, 0.8, 1.2]

y2 = [...,..,..,..]

Of course this will be an estimation.当然,这将是一个估计。 Tried different things with no luck.在没有运气的情况下尝试了不同的事情。 The sample frequency is very high, so some down sampling is not a problem.采样频率非常高,所以一些下采样不是问题。

>>> import numpy as np
>>> y1 = np.array([5, 6 , 4, 1])
>>> x1 = np.array([0.0, 0.3, 0.8, 1.1])
>>> period = 0.4

>>> x2 = period * np.arange(len(x1)) 
>>> x2
array([ 0. ,  0.4,  0.8,  1.2])

>>> np.interp(x2, x1, y1)
array([ 5. ,  5.6,  4. ,  1. ])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python 使用 MCP3008 采样频率 - Python using MCP3008 sample frequency 计算音频样本的平均基频 - Calculation of mean fundamental frequency of audio sample 保持套接字连接,数据频率不规则 - maintaining socket connection, irregular data frequency 在离散时间采样IIR滤波器系统中从采样率/截止频率转换为pi-弧度/采样 - Converting from samplerate/cutoff frequency to pi-radians/sample in a discrete time sampled IIR filter system 为什么我的输出不考虑其他所有样本,为什么频率是期望值的一半? - Why is my output disregarding every other sample and why is the frequency half of the expected value? 给定时间戳数组、采样频率和偏移量,创建所有可能时间戳的集合 - Given an array of timestamps, a sample frequency and a offset, create the set of all possible timestamps 如何选择正确的 linspace 样本数据以获得正确的主频结果 - How to choose correct linspace sample data to obtain correct dominant frequency result MPU6050中I2C工作频率与采样率设置之间的关系 - Relationship between I2C operating frequency and sample rate setting in MPU6050 具有一组 delta 的不规则数字列表示例 - Sample irregular list of numbers with a set delta Python中的频率分析-使用频率而不是频率来打印字母 - Frequency Analysis in Python -Print letters with frequency rather than numbers with frequency
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM