How to convert complex one sided spectrum into time domain

조회 수: 66 (최근 30일)
Hi!
I have a one sided spectrum with complex values.I want to convert in back to time domain. As I se, the matlab ifft function converts two sided spectrum into time domain. My qustion is, is there a matlab function that can apply invers fourier transform on one sided spectrum? If there isn't how can I conert a complex one soided spectrum to two sided?

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2021년 3월 18일
You can do something like this:
function fft4real = symmetrize(fftOnesided)
fft4real = [fftOnesided,0, fliplr(conj(fftOnesided(:,2:end)))];
end
If you try this on something like this:
t = 0:127;
I = sin(2*pi/128*3*t) + 0.4*sin(2*pi/128*7.2*t) + randn(size(t))/17;
fI = fft(I);
ssfI = fI(1:end/2);
tsfI = symmetrize(ssfI);
clf
plot(t,I)
hold on
plot(t,ifft(tsfI))
You'll see that you have an almost perfect fit, there is a missing sample at the Nyquist-frequency but that's unavoidable, I think. This obviously assumes that your original signal is real-valued...
HTH
  댓글 수: 2
Csanad Levente Balogh
Csanad Levente Balogh 2021년 3월 18일
Thank you! This looks good. I noticed you only use the following code for the transformation to single sided spectrum:
ssfI = fI(1:end/2);
What if the spectrum was calculated from operations with other spectrums and the single sided transformation of those spectrums is done as shown in the eaxmples of fft?
FI = fft(I);
P2 = FI/L;
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
Bjorn Gustavsson
Bjorn Gustavsson 2021년 3월 18일
Ah, I forgot that one should take into account the amplitude of the negative frequency-coefficients when converting to the single sided spectrum. That is all, then for that case one should correspondingly divide all non-DC components with 2 to correct for that, when converting the single-sided spectrum to a 2-sided.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2021년 3월 18일
You specifically mention "complex one sided". Is the implication that the frequency data you have is complex valued but the time domain data is intended to be real-valued? If so then that can be handled without much difficulty. However if the time-domain data is intended to be complex-valued then you do not have enough information to reconstruct it.
Assuming that it is the positive frequencies in the data, and that the first entry in the data is the "0" frequency, then
%build some demonstration data
N = 127;
F0 = 10; %total signal, mean times signal length
F1 = [F0, complex(randn(1,N),randn(1,N)).*exp(-(1:N)./N)];
%F1 is the demonstration one-sided complex frequency-domain signal.
plot(abs(F1)); title('one-sided frequency')
%reconstruct
F2 = [F1, fliplr(conj(F1(2:end)))];
%F2 is the reconstructed two-side complex frequency-domain signal
plot(abs(F2)); title('two-sided reconstructed frequency')
%ifft
td = ifft(F2);
whos td
Name Size Bytes Class Attributes td 1x255 2040 double
plot(td); title('time domain')

카테고리

Help CenterFile Exchange에서 Discrete Fourier and Cosine Transforms에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by