相位空间图的圆锥形插值
我正在创建电压的第一衍生物的相空间图:
我想插入图块平滑。到目前为止,我已经通过时间插值电压和第一个导数,然后随时间分别插入电压,然后生成相空间图。
Python代码(玩具数据示例)
import numpy as np
import scipy.interpolate
interp_factor = 100
n = 12
time = np.linspace(0, 10, n)
voltage = np.array([0, 1, 2, 10, 30, 70, 140, 150, 140, 80, 40, 10])
voltage_diff = np.diff(voltage)
voltage = voltage[:-1]
time = time[:-1]
interp_function_voltage = scipy.interpolate.interp1d(time, voltage, kind="cubic")
interp_function_voltage_diff = scipy.interpolate.interp1d(time, voltage_diff, kind="cubic")
new_sample_num = interp_factor * (n - 1) + 1
new_time = np.linspace(np.min(time), np.max(time), new_sample_num)
interp_voltage = interp_function_voltage(new_time)
interp_voltage_diff = interp_function_voltage_diff(new_time)
我想问的是
: a)该方法是否合理?
b)通过直接在相空间中插值来有更好的方法?例如,用电压插值为x和vytage_diff,为y?我认为这是没有道理的,因为电压值不均匀间隔,并且可能有重复的电压值。我还尝试了Scipy参数插值方法(例如scipy.interpaly.splprep),但这些输入值误差。我希望(澄清一下会很高兴),因为这是原始数据,而不是行为良好的参数函数。
我想更一般地,我想知道在相位上以某种方式进行插值是否有意义,以利用电压和电压_diff之间的直接关系进行插值 /平滑。
非常感谢
I am creating a phase-space plot of first derivative of voltage against voltage:
I want to interpolate the plot so so it is smooth. So far, I have approached this by interpolating the voltage and first derivative of the voltage separately with time, then generating phase space plots.
Python Code (toy data example)
import numpy as np
import scipy.interpolate
interp_factor = 100
n = 12
time = np.linspace(0, 10, n)
voltage = np.array([0, 1, 2, 10, 30, 70, 140, 150, 140, 80, 40, 10])
voltage_diff = np.diff(voltage)
voltage = voltage[:-1]
time = time[:-1]
interp_function_voltage = scipy.interpolate.interp1d(time, voltage, kind="cubic")
interp_function_voltage_diff = scipy.interpolate.interp1d(time, voltage_diff, kind="cubic")
new_sample_num = interp_factor * (n - 1) + 1
new_time = np.linspace(np.min(time), np.max(time), new_sample_num)
interp_voltage = interp_function_voltage(new_time)
interp_voltage_diff = interp_function_voltage_diff(new_time)
I would like to ask:
a) is the method as implemented reasonable?
b) is there a better method by interpolating directly in the phase-space? e.g. interpolating with voltage as x and voltage_diff as y? I do not think this makes sense, because the voltage values are not uniformly spaced and there may be repeated voltage values. I also tried the scipy parametric interpolation methods (e.g. scipy.interpolate.splprep) but these threw input value error. I expect (it would be nice to have this clarified) because this is raw data, rather than well behaved parametric functions.
I guess more generally, I am wondering if it makes sense to somehow do the interpolation in the phase-space to make use of the direct relationship between voltage and voltage_diff for interpolating / smoothing.
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是合理的,但是您的区别会偏见,也许差异的最佳近似可能是
(v [i+1] -v [i -1])/(2*dt)
另一种方法正在使用傅里叶变换平滑
It is reasonable, but your difference will be biased, maybe the best approximation for the difference could be
(v[i+1] - v[i-1])/(2*dt)
Another approach is using Fourier transform smoothing