如何在 Matlab 中按小数步移动信号?

How to shift signal by fractional step in Matlab?

我有两个来自示波器的信号。他们每个人都有 1000 个点,步长为 1ns。我需要查看信号之间的区别。但是信号偏移了 0.31ns。我可以使用命令

创建两个具有对齐信号的图
plot(time, signal1, time+0.31, signal2);

但是如何绘制去偏移(对齐)信号的差异?

使用interp1函数:

vq = interp1(x,v,xq)
vq = interp1(x,v,xq,method)
vq = interp1(x,v,xq,method,extrapolation)

vq = interp1(x,v,xq) returns interpolated values of a 1-D function at specific query points using linear interpolation. Vector x contains the sample points, and v contains the corresponding values, v(x). Vector xq contains the coordinates of the query points.

对于您的示例,请尝试类似的操作:

signal2_prime = interp1(time+0.31, signal2, time);
plot(time, signal1, time, signal2_prime)