0
$\begingroup$
accf=fft([zeros(1000,3);acc;zeros(1000,3)]);

cutoff1=0;

X1=[0,0,0;
               zeros(round((size(accf,1)-1)/2*cutoff1/50),3);  %% 50 ??
               ones(ceil((size(accf,1)-1)/2)-round((size(accf,1)-1)/2*cutoff1/50),3);
               ones(floor((size(accf,1)-1)/2)-round((size(accf,1)-1)/2*cutoff1/50),3);
               zeros(round((size(accf,1)-1)/2*cutoff1/50),3)];

X2=angle(accf);

X=X1.*exp(X2*sqrt(-1));

acc=real(ifft(X));

acc=acc(1001:end-1000,:);

I guess this is some kind of filtering. Can you help me to find the reference materials for the math?

$\endgroup$
1
  • $\begingroup$ if you pad zeros directly on an fft spectrum you are increasing or decreasing frequency. Then when ifft you may obtain a frequency shifted signal. $\endgroup$ Jan 12, 2023 at 9:38

1 Answer 1

1
$\begingroup$

This makes little sense.

  1. it zero pads the input on both sides and does an FFT
  2. it generates a matrix of the same size with all ones except for the first first row which is zero
  3. It copies the phase of the FFT result to the matrix of ones
  4. It does an inverse FFT

So it's simply the inverse FFT of the input signal but with the magnitude set 1 (other than DC which is 0)

I'm guessing that this is supposed to generate some sort of rectangular mask window but with setting cutoff1 = 0 it's all just ones and there is really no reason to create the matrix in such a tortured way. You could simply do X1 = ones(size(accf)); X1(1,:) = 0;

$\endgroup$
7
  • $\begingroup$ So this is not a filter? Like high pass or low pass. Because the plot before and after this process is very different. $\endgroup$
    – Keisuke
    Dec 9, 2022 at 9:19
  • $\begingroup$ It's definitely not a filter $\endgroup$
    – Hilmar
    Dec 9, 2022 at 9:20
  • $\begingroup$ So what this process is doing and why? $\endgroup$
    – Keisuke
    Dec 9, 2022 at 9:21
  • $\begingroup$ Of course it's different, the code sets the magnitude of the FFT to 1. That's a highly non-linear operation $\endgroup$
    – Hilmar
    Dec 9, 2022 at 9:21
  • 1
    $\begingroup$ I have no idea. As I said: this makes very little sense. Ask the source. $\endgroup$
    – Hilmar
    Dec 9, 2022 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.