effects of ifft2(x, 'symmetric') while x is not conjugate symmetric

88 visualizaciones (últimos 30 días)
Justin
Justin el 23 de Nov. de 2025 a las 1:13
Comentada: Matt J hace alrededor de 4 horas
Hi all,
I understand that 'symmetric' in ifft2 assumes data is conjugate symmetric and will output real values, but I want to know how exactly is this done. Specifically:
  1. with 'symmetric', will only half of the data be used or still the whole matrix is used, but just output real values?
  2. if x is not conjugate symmetric but I still pass in 'symmetric', what will happen?
Thanks in advance.

Respuesta aceptada

Matt J
Matt J el 23 de Nov. de 2025 a las 1:44
Editada: Matt J el 23 de Nov. de 2025 a las 1:45
When you specify "symmetric", the upper half of the fft input array is ignored, e.g.
x=ones(1,7);
ifft(x)
ans = 1×7
1.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
x(5:end)=rand(1,3); %write random junk into the upper half of x
ifft(x)
ans =
0.8258 + 0.0000i 0.0750 + 0.0982i -0.0516 - 0.0461i 0.0637 + 0.1255i 0.0637 - 0.1255i -0.0516 + 0.0461i 0.0750 - 0.0982i
ifft(x,'symmetric')
ans = 1×7
1.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
  4 comentarios
Paul
Paul el 23 de Nov. de 2025 a las 2:55
I don't think that's true for the rows that aren't in the first column.
X = ifft2(rand(10));
x1 = ifft2(X,'symmetric');
X(end,3) = 0;
x2 = ifft2(X,'symmetric');
isequal(x1,x2)
ans = logical
0
Matt J
Matt J el 23 de Nov. de 2025 a las 14:19
Editada: Matt J el 23 de Nov. de 2025 a las 14:37
Yep, my bad. In higher dimensions, conjugate symmetry means the image is symmetric across the origin. So, if you view the array after fftshift(), the cells it would be using are the right half, minus half of one of the DC axes. In other words, it needs cells from two quadrants to cover the whole array by symmetry, and also only the non-negative DC axes are needed.
If you re-organize this in terms of the original ordering of X(i,j) it means the cells that can be discarded are the light-shaded ones below, which is consistent with what @Paul found in his tests:

Iniciar sesión para comentar.

Más respuestas (1)

Paul
Paul el 23 de Nov. de 2025 a las 2:24
Editada: Paul el 23 de Nov. de 2025 a las 16:44
It appears that only portions of the input matrix are used when 'symmetric' is specified on input to ifft2 and the input is 2D
rng(100);
X = rand(10,12) + 1j*rand(10,12); % non-symmetric input
x1 = ifft2(X,'symmetric');
X(:,8:12) = 0; % zero out the entire right side
X(7:10,1) = 0; % zero out the top half of the first column
x2 = ifft2(X,'symmetric');
isequal(x1,x2)
ans = logical
1
  10 comentarios
Paul
Paul hace alrededor de 7 horas
Referring back to this comment:
"Clearly they didn't assume that when ismatrix(X)=true. In that case, even large breaks in conjugate symmetry are not felt in the result."
I think that is basically a bonus. In other words, the developers' (hypothesized) intent is to use 'symmetric' when the input is not symmetric only due to numerical trash. The fact that the ifft2 happens to yield the expected result with symflag 'symmetric' when ismatrix(X) = true even when X is far from symmetric is not in conflict with the (hypothesized) intent.
From ifft2:symflag : "When Y is not exactly conjugate symmetric due to round-off error, ...."
In any case, will be ineresting hear their reponse to your bug report.
Matt J
Matt J hace alrededor de 4 horas
I don't have a response from the yet, probably due to Thanksgiving.
Regardless of developer intent, though, the documentation says we are supposed to get the same result from ifft2(X) as we would from ifft2nLoop(X), when X is n-D. So, at the very least, I think it has to be a documentation bug.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by