0

信号のフーリエ変換と逆フーリエ変換を計算し、そのグラフ (振幅と位相) をプロットする必要があります。

ここに画像の説明を入力

Matlabでこれを行う方法は? 私が知っているように、Matlab はfftDFT を計算する組み込み関数を提供しており、おそらく結果を DFT から DTFT に変換することが可能です。fft内部を使用してDTFTを取得する関数を見つけました。

function [H, W] = dtft(h, N)
%DTFT   calculate DTFT at N equally spaced frequencies
%----
%   Usage:   [H, W] = dtft(h, N)
%
%      h : finite-length input vector, whose length is L
%      N : number of frequencies for evaluation over [-pi,pi)
%              ==> constraint: N >= L 
%      H : DTFT values (complex)
%      W : (2nd output) vector of freqs where DTFT is computed

%---------------------------------------------------------------
% copyright 1994, by C.S. Burrus, J.H. McClellan, A.V. Oppenheim,
% T.W. Parks, R.W. Schafer, & H.W. Schussler.  For use with the book
% "Computer-Based Exercises for Signal Processing Using MATLAB"
% (Prentice-Hall, 1994).
%---------------------------------------------------------------

N = fix(N);
L = length(h);  h = h(:);  %<-- for vectors ONLY !!!
if( N < L )
   error('DTFT: # data samples cannot exceed # freq samples')
end;
W = (2 * pi / N) * (0:(N-1))';
mid = ceil(N/2) + 1;
W(mid:N) = W(mid:N) - 2 * pi;   % <--- move [pi,2pi) to [-pi,0)
W = fftshift(W);
H = fftshift(fft(h,N));  %<--- move negative freq components
end

この関数を変更して IDTFT を取得する方法を教えてください。または、誰かがこのタスクを実行するための他の同様の機能を持っているかもしれません。

4

1 に答える 1

4

IDTFT は単純な積分である必要があるため、次のようにすることができます。

X_r = ifft(ifftshift(X_w))

単純な正弦波でこれを確認してみましょう。

%// Generate input signal
t = linspace(0, 10, 1000);
x = sin(2 * pi * t);

%// Compute DTFT and IDTFT
[X_w, F] = dtft(x, 1000);   %// DTFT
X_r = ifft(ifftshift(X_w)); %// IDTFT

%// Plot the result
figure
subplot(2, 1, 1), plot(t, x)
subplot(2, 1, 2), plot(t, X_r)

これにより、次のプロットが生成されます。

ここに画像の説明を入力

于 2013-01-01T14:26:30.377 に答える