2017-05-11 9 views
2

私は片面離散フーリエ変換から実数ウェーブレットwを得ることを試みています。理論によれば、負の周波数側は正の周波数側の複素共役ですが、Matlab(ifft()関数を使用して)で実装すると頭がおかしくなります。以下では、減衰された正弦ウェーブレットwを周波数領域Wに変換する小さなプログラムをリストアップしています。正の部分を抽出してconj(flipud(W))で補うことはできますが、逆FFTは入力ウェーブレット振幅は何か他のもので変調される。しかし、w = ifft(W、 'symmetric')はうまく動作します。問題を特定するための提案は高く評価されます。片面スペクトル+エルミートから復帰時間

clc; clear all 
% Genetate a damped sine wavelet 
n = 100; 
n2 = floor(n/2)+ 1; 
dt = .25; 
for i = 1:n 
    t = (i-1)*dt; 
    w(i,1) = 100 * sin(t) * exp(-0.2*t); 
end 

figure; subplot(3,2,1); plot(w); 
title('The Signal') 
%------------------------------------- 
W1 = fft(w);     % 2-sided 
n2 = floor(n/2)+ 1; 
W2 = fft(w,n2);    % 1-sided 
subplot(3,2,3);plot(real(W2)); 
title('2-sided abs(W2)') 
subplot(3,2,5);plot(imag(W2)); 
title('2-sided angle(W2)') 
%------------------------------------- 

w1 = ifft(W1) ;     % Works fine 
subplot(3,2,2); plot(w1); 
title(' w2 = ifft(W2); (2-sided) '); 

% -------------------------------------- 
% Use the /symmetric/ option of ifft() with 
% the single-sided spectrum 

w2 = ifft(W2 , 'symmetric'); % 1-sided, works fine 

subplot(3,2,4);plot(w2,'k'); 
title('w2 = ifft(W2, "symmetric")') 

% -------------------------------------- 
% Calculate the complex-cojugate of 1-sided W2 
% (excluding the zero frequency point?!), flip it, 
% and attach it to the tail of W2 col vector. 

H = flipud(conj(W2(2:n2))); 
W3 = [W2 ; H]; 
w3 = ifft(W3) ; % sourse of my migraine headache 
% If you let n =1000 instead of the 100, the effect of 
% amplitude-modulation-like effect is less and the output 
% (bottom right graph)resembles the input wavelet but 
% with a thicker line. 
% If n=100 and W2(1:n2-1) in H = ... is used instead 
% of the W2(2:n2), you'll get a flying bold eagle! 


subplot(3,2,6);plot(w3,'k'); 
title('w3 = ifft([W2 ; H]') 
%---end of the program------------------- 

答えて

0

以下の作品が、以前のものはしなかった理由を私はまだ考え出したていない:ここで

はリストである

clc; clear all 

% Genetate a damped sine wavelet 
n = 101; n2 = floor(n/2) + 1; dt = 0.25; 

t = [(0:1:n-1)*dt]'; w = sin(t).*exp(-0.2*t); 

figure; subplot(2,1,1);plot(w); 
title('The Wavelet') 

W1 = fft(w);    % 2-sided 
W2 = W1(1:n2);    % 1-sided 

H = flipud (conj(W1(2:n2))); 
W3 = [W2 ; H]; 
w3 = ifft(W3);    % 2-sided 

subplot(2,1,2); plot(w3); 
title('w3 = ifft([ W3; H ]') 

%---------- end of the program---------- 
0

問題は、この行を次のとおりです。

W2 = fft(w,n2);    % 1-sided 

これは、最初のn2出力を返すという暗黙の前提とは異なりlength(w)サイズのFFT(期待されている片側スペクトラムが得られる場合)の代わりに、wのフルFFT(両側スペクトル)がn2サンプルに切り捨てられます。

あなたの更新されたコードがでないよう修正は、WのフルFFTを計算し、結果の最初のn2のサンプルを選択し、次にある:

W1 = fft(w); 
W2 = W1(1:n2); 
関連する問題