【问题标题】:Matlab: Fourier Transform After changing phase matrixMatlab:改变相位矩阵后的傅里叶变换
【发布时间】:2014-12-07 19:51:03
【问题描述】:

我正在做一些信号项目,我想做的就是对信号应用傅立叶变换,得到 ma​​gnitudephases,然后更改 相位 矩阵到别的东西说 phasenew 然后从 ma​​gnitudephasenew 获取信号。

我的代码基于Getting Fourier Transform from Phase and Magnitude - Matlab

>> F = fft(x);
>> mag =  abs(F);
>> phase = angle(F);
% Calculate phasenew using some algorithm, phasenew is very similar to phase, so output should be same.
>> re = mag .* cos(phasenew);
>> im = mag .* sin(phasenew);
>> F_i = complex(re,im);
>> x_i = ifft(F_i);

输出信号x_i非常不同。

我在这里也发现了类似的问题:Fourier Transform: getting mag + phase then using those to plot original signal 但在此链接中,我评论了向@David 询问我应该如何着手解决 phasenew 的情况的答案。他建议我作为一个新问题提出这个问题,所以就在这里。

请帮助我使用傅立叶逆变换原始幅度新相位生成信号。 提前致谢。

附:在 phasenew 中,我只是将 phase 移动 π/2 或 -π/2。

【问题讨论】:

  • 顺便说一句。如果您只是将相位移动一个常数,则与将原始输入乘以一个固定的复数常数相同。

标签: matlab image-processing matrix fft ifft


【解决方案1】:

对我来说,你的方法有效:

x = rand(100, 1);
y = fft(x);
mag = abs(y);
phase = angle(y);
y2 = mag .* (cos(phase) + 1i * sin(phase));
y3 = complex(mag .* cos(phase), mag .* sin(phase));
sum(abs(y-y2).^2)
sum(abs(y-y3).^2)
x2 = ifft(y2);
x3 = ifft(y3);
sum(abs(x - x2).^2)
sum(abs(x - x3).^2)

以 1e-30 的顺序给出值,因此所有比较的信号 (y, y2, y3) 和 (x, x2, x3) 都是相同的,除了微小的数值偏差。

【讨论】:

  • sum函数有什么用?
  • @Jerky 得到两个信号的总偏差。 assert(y==y2) 会失败,但只会失败一小部分。在数值不确定的情况下,比较值是相同的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-17
  • 1970-01-01
  • 2015-08-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多