将傅立叶移位定理应用于复数信号 [英] apply fourier shift theorem to complex signal

查看:179
本文介绍了将傅立叶移位定理应用于复数信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将傅立叶相移定理应用于R中的复数信号但是,只有我的信号幅度会发生变化.我认为应该可以将此定理应用于复杂信号,所以我可能在某个地方犯了错误.我的猜测是,我计算出的频率轴存在误差.

Im trying to apply the fourier phase shift theorem to a complex signal in R. However, only the magnitude of my signal shifts as I expect it. I think it should be possible to apply this theorem to complex signals, so probably I make an error somewhere. My guess is that there is an error in the frequency axis I calculate.

如何正确地将傅立叶移位定理应用于复数信号(使用R)?

How do I correctly apply the fourier shift theorem to a complex signal (using R)?

i = complex(0,0,1)
t.in = (1+i)*matrix(c(1,0,0,0,0,0,0,0,0,0))
n.shift = 5

#the output of fft() has the mean / 0 frequency at the first element
#it then increases to the highest frequency, flips to negative frequencies
#and then increases again to the negative frequency closest to 0
N = length(t.in)
if (N%%2){#odd
  kmin = -(N-1)/2
  kmax = (N-1)/2
} else {#even
  kmin = -N/2
  kmax = N/2-1
  #center frequency negative, is that correct?
}

#create frequency axis for fft() output, no sampling frequency or sample duration needed
k = (kmin:kmax)
kflip = floor(N/2)
k = k[c((kflip+1):N,1:kflip)]
f = 2*pi*k/N

shiftterm = exp( -i*n.shift*f )

T.in = fft(t.in)
T.out = T.in*shiftterm
t.out = fft(T.out, inverse=T)/N

par(mfrow=c(2,2))
plot(Mod(t.in),col="green"); 
plot(Mod(t.out), col="red");
plot(Arg(t.in),col="green");
plot(Arg(t.out),col="red");

如您所见,信号幅度发生了很好的偏移,但相位却被打乱了.我认为负频率是我的错误所在,但我看不到它.

As you can see the magnitude of the signal is nicely shifted, but the phase is scrambled. I think the negative frequencies are where my error is, but I cant see it.

我在做什么错了?

我可以找到有关傅立叶相移定理的问题:

The questions about fourier phase shift theorem I could find:

真实2D信号在python中

matlab中的真实2d信号

Python中的真实一维信号

关于傅立叶移位的数学问题 a>

但是这些与复杂信号无关.

But these were not about complex signals.

推荐答案

答案

正如史蒂夫(Steve)在评论中建议的那样,我检查了第6个元素的相位.

As Steve suggested in the comments, I checked the phase on the 6th element.

> Arg(t.out)[6]
[1] 0.7853982
> Arg(t.in)[1]
[1] 0.7853982

因此,唯一具有幅度(比EPS高至少一个数量级)的元素确实具有我期望的相位.

So the only element that has a magnitude (at least one order of magnitude higher than the EPS) does have the phase that I expected.

TL; DR 问题中原始方法的结果已经正确,我们看到了吉布斯现象.

只丢弃低强度元素吗?

如果元素的相位应该为零将是一个问题,我可以运行t.out[Mod(t.out)<epsfactor*.Machine$double.eps] = 0,在这种情况下,必须将epsfactor设置为10才能消除幅度为'0'的元素.

If ever the phase of elements that should be zero will be a problem I can run t.out[Mod(t.out)<epsfactor*.Machine$double.eps] = 0 where in this case epsfactor has to be 10 to get rid of the '0' magnitude elements.

在绘制之前添加该行会得到以下结果,这是我希望事先获得的结果.但是,加扰"阶段实际上在大多数情况下可能是准确的,正如我将在下面解释的那样.

Adding that line before plotting gives the following result, which is what I expected to get beforehand. However, the 'scrambled' phase might actually be accurate in most cases as I'll explain below.

原始结果确实正确

仅将低幅度元素设置为0并不会使移位信号的相位更加直观.这是我在其中进行4.5个样本移位的图,相位仍处于混乱状态".

Just setting low magnitude elements to 0 does not make the phase of the shifted signal more intuitive however. This is a plot where I apply a 4.5 sample shift, the phase is still 'scrambled'.

应用与向下映射移位傅立叶插值等效的傅立叶移位

在我看来,应用非整数数量的元素相移等效于对信号进行傅立叶内插,然后在原始元素之间的点处对内插信号进行下采样.由于我用作输入的向量是一个脉冲函数,因此傅立叶插值信号表现得不好.然后,可以预期在应用傅立叶相移定理后的信号具有与傅立叶内插信号具有的相位完全相同的信号,如下所示.

It occurred to me that applying a non-integer number of elements phase shift is equivalent to fourier interpolating the signal and then downsample the interpolated signal at points between the original elements. Since the vector I used as input is an impulse function, the fourier interpolated signal is just not well behaved. Then the signal after applying the fourier phase shift theorem can be expected to have exactly the phase that the fourier interpolated signal has, as seen below.

吉布斯铃声

仅在相位表现不佳且舍入误差较小可能在重构相位中导致较大误差的不连续点处.因此,它与低幅度无关,但与输入向量的傅立叶变换定义不明确.这称为 Gibbs振铃,我可以使用低通过滤 rel ="nofollow noreferrer">高斯过滤器将其减少.

Its just at the discontinuities where phase is not well behaved and where small rounding errors might cause large errors in the reconstructed phase. So not really related to low magnitude but to not well defined fourier transform of the input vector. This is called Gibbs Ringing, I could use low-pass filtering with a gaussian filter to decrease it.

与傅里叶插值和相移有关的问题

R中的符号方法来估计傅立叶转换错误

非整数信号移位线性插值的使用

对复杂信号进行下采样

傅里叶插值应用程序

估算使用傅立叶变换在两个信号之间进行子样本移位

在没有插值的情况下估计两个信号之间的子采样偏移

这篇关于将傅立叶移位定理应用于复数信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆