Simulink IFFT complex rounding error?

Hello Matlab-Community,
when I compute the IFFT in a Simulink Function-Block, the result has a small imaginary part of ~10e-17. When I do the exact same computation in Matlab, I get a real signal. Does anyone know why this happens?
Best regards,
Peter

댓글 수: 7

JCO
JCO 2023년 3월 2일
Have you ever gotten this resolved? I’m having the same issue.
Peter Santner
Peter Santner 2023년 3월 2일
No, I think the workaround was to just use the real part, since the imaginary part is just a calculation inacurracy
Paul
Paul 2023년 3월 4일
Is the issue with a Simulink Fuction or a Matlab Function block? Or perhaps the latter embedded inside the former ?
Peter Santner
Peter Santner 2023년 3월 6일
I think in Matlab it works, seems to be a problem just within Simulink.
Paul
Paul 2023년 3월 6일
Which specific block within Simulink? Can you provide a link to the doc page for the specific block in which the IFFT is being computed?
Peter Santner
Peter Santner 2023년 3월 6일
The standard IFFT-Block:
https://de.mathworks.com/help/dsp/ref/ifft.html
Paul
Paul 2023년 3월 6일
Is the 'Input is conjugate symmetric' parameter set to on? doc page

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

답변 (1개)

Saurav
Saurav 2024년 2월 24일

0 개 추천

Hey, Peter,
I understand that when you perform an IFFT computation in Simulink, you obtain a tiny imaginary component in the range of about 10e-17, but when you perform the same computation in MATLAB, you obtain the right results.
It is crucial to note that this is a highly input-specific issue because not all inputs cause it to occur. For example, when attempting to determine the IFFT for the time domain signal, let's say t = [0,1,1,1,1,1,1,1,1,1,0] or [1,0,0,0,0,1], you will observe that the first value at the end of the vector is implicitly repeated while the vector is being processed. Your vector actually looks like this: 0, 1, 1, 1,..., 1, 1, 1, 0, 0, 1, 1, 1,..., 1, 1, 1, 0. The FFT or IFFT in such cases presume that your data is periodic. Observe the consecutive 0’s that appear in between the signal's periods. These types of inputs usually result in round-off errors.
Here is a workaround that you can follow to avoid round-off errors:
  • If you know that your input to the IFFT block is conjugate symmetric (which is the case for real-valued time-domain signals), you can enable the “Input is conjugate symmetric” option in IFFT block parameters to expect a conjugate symmetric input. This will ensure that the output is forced to be real.
  • Sometimes, switching to a higher precision data type (like double precision) can reduce the effect of numerical errors.
Please refer to the following documentation for an explanation of this epsilon round-off error, which is sometimes inevitable due to finite precision in the computer hardware:
I hope this contributes to your understanding.

카테고리

제품

릴리스

R2021a

질문:

2021년 7월 8일

답변:

2024년 2월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by