2D FFT square function

1 回表示 (過去 30 日間)
T B
T B 2017 年 9 月 17 日
コメント済み: jyoti mundra 2017 年 11 月 9 日
I am trying to perform the 2D FFT on the square function. I have defined the square function using:
if true
deltax = L/N;
deltay = L/N;
x = [-L/2:deltax:L/2-deltax];
y = [-L/2:deltay:L/2-deltay];
[X,Y]=meshgrid(x,y);
func = double(abs(X)<= b/2).*double(abs(Y)<= b/2);
figure;
surf(X,Y,func);
end
This does give the expected answer, namely:
However, when I go further and try and do the FFT using the following code:
if true
% code
end
deltafx = 1/L;
deltafy = 1/L;
fx = [-1/(2*deltax):deltafx:1/(2*deltax)-deltafx];
fy = [-1/(2*deltay):deltafy:1/(2*deltay)-deltafy];
[FX,FY]=meshgrid(fx,fy);
funcfourier=deltax*deltay*fft2(func);
funcfourier=fftshift(funcfourier);
absfuncfourier=abs(funcfourier);
surf(FX,FY,absfuncfourier);
gives:
which is not what I expected as I cannot read any amplitudes of that plot. I do not really know what went wrong here.
Any suggestion of how to show this in 3D is appreciated. Thanks
  1 件のコメント
jyoti mundra
jyoti mundra 2017 年 11 月 9 日
Please let me know what is L and N in your code?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by