フィルターのクリア

ifft and fft problem

3 ビュー (過去 30 日間)
J J
J J 2012 年 7 月 22 日
Hi all, this is probably very trivial but I am not understanding what the source of discrepancy is:
I have a gamma distribution (h1), I take its fft and then ifft. I should get the same thing (h1), but there is a factor 2 difference. Why?
k1 = 3; theta1 = 3;
% sparse sampling
dts = 1;
ts = (0:dts:359); % time
Ts = length(ts);
fs_s = 1/dts; % sampling frequency
dfs = fs_s/Ts;
f_s = (-fs_s/2:dfs:fs_s/2-dfs); % frequency
h1_s = (1/gamma(k1)) .* (ts.^(k1-1)) .* exp(-ts/theta1)/(theta1^k1);
h1_s_FT = dts*fftshift(fft(h1_s));
h1_s_hat = abs(f_s.*ifft(ifftshift(h1_s_FT)));
figure; plot(ts,h1_s,ts,h1_s_hat,'r')
I am missing a factor 2 somewhere. Thanks.
  1 件のコメント
J J
J J 2012 年 7 月 22 日
Note that the real and imaginary fft plots look correct. So I guess there is something about ifft that I am missing.

サインインしてコメントする。

採用された回答

Dr. Seis
Dr. Seis 2012 年 7 月 23 日
編集済み: Dr. Seis 2012 年 7 月 23 日
Did you mean to use "fs_s" instead of "f_s" here:
h1_s_hat = abs(fs_s.*ifft(ifftshift(h1_s_FT)));
I guess that's why you needed ".*" instead of "*" to get it to work.
  1 件のコメント
J J
J J 2012 年 7 月 23 日
oh!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTransforms についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by