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
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)
ans = 0
all(c(2:end))
ans = logical
1
David Goodmanson
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
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.
  1 个评论
Marko Jankovic
Marko Jankovic 2023-7-2
Hello Mihir,
thanks for response!
With the variable c I get real values,
I would like the same with the variable c1!
How can I realize that?
Thanks

请先登录,再进行评论。

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by