Multiplication of complex numbers and ISTFT result
3 ビュー (過去 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!