one (single)-sided fft and fft2

9 vues (au cours des 30 derniers jours)
Linan Xu
Linan Xu le 19 Juin 2018
Commenté : David Goodmanson le 20 Juin 2018
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 commentaires
Linan Xu
Linan Xu le 20 Juin 2018
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 le 20 Juin 2018
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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by