2014-12-07 130 views
0

我的一些信號項目的工作後,所有我想要做的是應用在信號的傅立葉變換,得到幅度階段,然後更改階段矩陣別的東西說phasenew然後從量級phasenew得到信號。Matlab的:傅立葉變換相位變化了矩陣

我立足於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的問題的答案。他建議我把這個問題當成一個新問題,就這樣了。

請幫我生成使用傅立葉逆變換信號從原始數值新階段變換。 在此先感謝。

P.S. phasenew我只是將階段移位π/ 2或-π/ 2。

+0

Btw。如果您只是將相位移動一個常數,則它將原始輸入乘以固定的複數常數。 – Trilarion 2014-12-07 20:03:02

回答

0

對我來說,你的方法的工作原理:

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)是指除相同微小的數值偏差。

+0

和函數的用途是什麼? – Jerky 2014-12-07 20:02:07

+0

@Jerky爲了得到兩個信號的總和偏差。斷言(y == y2)將失敗,但只有一小部分。至於數值不確定性,比較值是相同的。 – Trilarion 2014-12-07 20:04:27