MATLAB: How to invert nested functions in MATLAB

fftnfftshiftfinversefunctionfunction inverseifftnifftshiftMATLAB

If I have a variable (let's call it a) and then I apply the following multiple functions to transform it into a second variable, (b), how would I reverse it?
b = fftshift(fftn(fftshift(a)));
I tried doing the following:
c = ifftshift(ifftn(ifftshift(b)));
If this had worked, c would have been equal to a (the initial, non-transformed data set). Why doesn't it? Is there a better, more universal way of reversing the function initially applied to A? I tried finverse, but it didn't work in the way I used it because fftshift works on doubles, and I was using a sym-type variable when I tried getting the inverse.
Any help is appreciated

Best Answer

"If I have a variable (let's call it a) and then I apply the following multiple functions to transform it into a second variable, (b), how would I reverse it?"
a=magic(3)
b = fftshift(fftn(fftshift(a)));
c = ifftshift(ifftn(ifftshift(b)))
Result:
a =
8 1 6
3 5 7
4 9 2
c =
8.0000 1.0000 6.0000
3.0000 5.0000 7.0000
4.0000 9.0000 2.0000