Multiplication of complex numbers and ISTFT result
조회 수: 5 (최근 30일)
이전 댓글 표시
Dear,
for what reason do I get complex double numbers as results after ifft in variable c1?
clear all
close all
clc
a = ones(1,128);
b = stft(a);
c = istft((b));
g = b .* (1 + 1i);
c1 = istft((g));
Thanks in advance!
댓글 수: 5
Paul
2023년 7월 3일
Hi David,
Not that it changes the substance of your comment, but c is not quite ones(1,128). The first element is zero. Just want to point this out because, unilke fft/ifft, stft and istft are not, in general, inverses of each other, which I learned when looking into this Question and thought might be of general interest.
a = ones(1,128);
b = stft(a);
c = istft(b);
c(1)
all(c(2:end))
David Goodmanson
2023년 7월 3일
Hi Paul,
I did not see that for this case, thanks for pointing it out. But at least linearity still applies, so b --> (1+i)*b still results in c1 = (1+i)*c and the issue remains.
답변 (1개)
Mihir
2023년 7월 2일
The complex double numbers you are getting as results after the inverse Fast Fourier Transform (ifft) in variable c1 are likely due to the nature of the STFT (Short-Time Fourier Transform) and its inverse operation.
In the code you provided, you start with a vector a of ones and compute the STFT using the stft function. The STFT represents the signal in the frequency domain using complex numbers. Each complex number represents the magnitude and phase of a specific frequency component at a particular time. By default, the stft function returns a complex matrix where each element is a complex number.
Afterwards, you multiply the STFT matrix b by (1 + 1i), creating a new complex matrix g. This multiplication introduces additional complex components to the frequency-domain representation.
Finally, you apply the inverse STFT (istft) to g, resulting in c1. The inverse STFT attempts to reconstruct the original time-domain signal from the modified frequency-domain representation. Since the STFT and its inverse are not perfect, and the multiplication with (1 + 1i) introduces complex components, it's expected to get complex double numbers as the result in c1.
To summarize, the complex double numbers you see in c1 are a consequence of the STFT and its inverse operation, as well as the complex multiplication you performed on the STFT matrix. If you need a real-valued output, you may consider modifying your code accordingly.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!