Find FFT and summation in 4D matrix

1 view (last 30 days)
Ali Kareem
Ali Kareem on 18 Jul 2016
Commented: Adam on 18 Jul 2016
Hello,
Please, I have F(8*409600*3) matrix. I want to reshape it into B(8*512*3*800) matrix (each row should divide into 800 parts) then I have to find Fast Fourier transform(FFT) for each (8*512) rows and multiply it by its conjugate and divide by a constant after that I have to find summation of elements of each row in fourth dimension and average them by the number of slices within the fourth dimension (800). I mean
(B(1,1,1,1) +B(1,1,1,2)+B(1,1,1,3)……+B(1,1,1,800))/800
(B(1,2,1,1) +B(1,2,1,2)+B(1,2,1,3)……+B(1,2,1,800))/800
And so on for each row.
I used below code it seems work but does not give a correct result.
F=rand(8,409600,3);
B=reshape(F,8,512,3,[]);
C1=fft(B, [],2);
C2=C1.*conj(C1);
C3=C2/(3000);
C4=sum(C3,4)/800;
Thanks
  2 Comments
Matt J
Matt J on 18 Jul 2016
Edited: Matt J on 18 Jul 2016
The code looks fine to me, although I think it would be better to do
C4=mean(C3,4);
Adam
Adam on 18 Jul 2016
You say you have to find the FFT for each (8*512) rows. After your reshape to B you are doing the FFT on dimension 2 which is going to do the FFT in 3d along the 512 dimension. Whether or not this is what you want I don't know.

Sign in to comment.

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!