First,I have a vector A
of length N
,through process
A1 = fft(A,N);
A2 = Filter(A1);
A3 = ifft(A2,N);
Now,I need compute the convolution of vector A2
with vector B
,vector B
is another vector with N
elements,I noticed that seemed that I could use
ifft(fft(A3,2N).*fft(B,2N))
to calculate convolution. fft(A3,2N)
means padding A3
with N
zeros.
In fact, A2 = fft(A3,N)
So, the problem is what can I do to avoid calculate A3 and fft(A3) by using A2?
Or maybe the problem is how can I use A2 to calculate fft(A3,2N)?I wan to know if I can reduce some calculations in the whole process.thanks.
Here is a matlab test
clear;
N = 4;
A = 1:4;
B = 3:6;
A1 = fft(A);
A2 = (A1).*2020+1234;%filter(no sense)
A3 = ifft(A2);
A4 = fft(A3,2*N);
B2 = fft(B,2*N);
x = xcorr(A3,B)%ans: 0.1952 0.4051 0.6958 1.0470 0.7676 0.5050 0.2424
x2 = ifft(A4.*conj(B2),2*N)%ans: 1.0470 0.7676 0.5050 0.2424 0 0.1952 0.4051 0.6958
x3 = ifft([A2(1:N/2) A2(N/2+1)/2 zeros(1, 2*N-length(A2)-1) A2(N/2+1)/2 A2(N/2+2:end)].*conj(B2),2*N)
%ans: 3.5624 4.2973 5.4391 6.3191 6.2232 5.2077 4.0659 3.4665
x
andx2
. Disregarding0
they are the same albeit with a shift. $\endgroup$A5 = fft([A3 zeros(1, M-length(A3))], M);
x3 = fftshift(abs(ifft(A5.* conj(B2), M)))
$\endgroup$