one (single)-sided fft and fft2

4 次查看(过去 30 天)
Linan Xu
Linan Xu 2018-6-19
The solution of FFT is symmetric. I am wondering whether there is a built-in function to produce a one(single)-sided solution. One-dimensional transform is simple. How can we make a 2D FFT producing a single-sided solution?
  7 个评论
Linan Xu
Linan Xu 2018-6-20
I forgot that fft(a')' is not fft(a). I have fixed the function ifft_half.
function [s] = ifft_half(s,n,opt)
% Inputs:
% s: one-sided Fourier coefficients (frequency domain).
% opt: 'fftshift' or none
% Output:
% S: full signal in the time domain.
tmp=iscolumn(s);
if tmp==0
s=s';
end
if mod(n,2)==0 %even number
S=[s;conj(flip(s(2:end-1)))];
else % odd number
S=[s;conj(flip(s(2:end)))];
end
if tmp==0
S=S';
end
if nargin==2
s=ifft(S);
else
s=ifft(ifftshift(s));
end
end
David Goodmanson
David Goodmanson 2018-6-20
Since the intent was simply to transpose input s to a column vector without complex conjugation, it might be clearer later on to take your previous code and use s.' instead of s' in a couple of places.
fft2(rand(4,4)) or fft2(rand(5,5)) or fft2(rand(5,4)) shows that placement of the complex conjugates is not so easy in the 2d case.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by