karanbanthia
Junior Member level 1

Hi all,
I am trying to compute 2N-point DFT of 2Z-point real valued input signal from N-point FFT, but I am getting mirror image in the first half of the spectrum as well.
Below is my MATLAB code
Input signal consists of frequencies: 40, 400 and 800Hz. Sampling freq. is 3072Hz.
Method used is mentioned in Texas instruments application report 'SPRA291', page no. 9

As can be seen from the output image, I am getting mirror image of input frequencies around 1536Hz which is unwanted.
Has anyone used this method to calculate 2N point FFT?
I am trying to compute 2N-point DFT of 2Z-point real valued input signal from N-point FFT, but I am getting mirror image in the first half of the spectrum as well.
Below is my MATLAB code
Input signal consists of frequencies: 40, 400 and 800Hz. Sampling freq. is 3072Hz.
Method used is mentioned in Texas instruments application report 'SPRA291', page no. 9
Code:
% This script computers 2N point FFT from 2N point real input signal by
% generating a complex signal of length N and computing N point FFT of this
% complex signal
Fs = 3072; % Sampling frequency in Hz
T = 1/Fs; % Sampling time interval
N = 1024; % No of samples to be taken
t = (0:T:(N*T)-T); % Time vector
% Generate the 2N point real input vibration signal
vibrationSignal = 0.4*sin(2*pi*40*t) + 0.2*sin(2*pi*400*t) + 0.25*sin(2*pi*800*t);
signalX = zeros(1,(N/2));
signalY = zeros(1,(N/2));
complexSignal = zeros(1,(N/2));
finalSpectrum = zeros(1,(N));
A = zeros(1,(N/2));
B = zeros(1,(N/2));
vibration_spectrum_real = zeros(1,(N/2));
vibration_spectrum_imag = zeros(1,(N/2));
k = 1;
for k=1:1:(N/2)
A(k) = (1 - (1i*exp((-1i*2*pi*k)/N)))/2;
B(k) = (1 + (1i*exp((-1i*2*pi*k)/N)))/2;
end
% Generate N point signal from 2N point real input signal
n = 1;
for i=1:2:(N-1)
signalX(n) = vibrationSignal(i);
signalY(n) = vibrationSignal(i + 1);
n = n + 1;
end
% Generate N point complex signal
for k=1:1:(N/2)
complexSignal(k) = signalX(k) + 1i*signalY(k);
end
% Compute FFT of N point complex signal
spectrum1_output = fft(complexSignal,(N/2))/(N/2);
% Perform the split operation
k = 1;
for k=1:1:((N/2))
vibration_spectrum_real(k) = real(spectrum1_output(k))*real(A(k)) - ...
imag(spectrum1_output(k))*imag(A(k)) + real(spectrum1_output((N/2)-k+1))*real(B(k)) +...
imag(spectrum1_output((N/2)-k+1))*imag(B(k));
vibration_spectrum_imag(k) = imag(spectrum1_output(k))*real(A(k)) + ...
real(spectrum1_output(k))*imag(A(k)) + real(spectrum1_output((N/2)-k+1))*imag(B(k)) -...
imag(spectrum1_output((N/2)-k+1))*real(B(k));
vibration_spectrum_real(N-k+1) = vibration_spectrum_real(k);
vibration_spectrum_imag(N-k+1) = -vibration_spectrum_imag(k);
end
for k=1:1:((N))
finalSpectrum(k) = vibration_spectrum_real(k) + 1i*vibration_spectrum_imag(k);
end
finalSpectrum = abs(finalSpectrum);
% Convert the x-axis range into Hz
x = ((Fs/N)*0) :(Fs/N) : (Fs/2)-1;
% Plot only the first half of spectrum
plot(x',finalSpectrum(1:N/2));

As can be seen from the output image, I am getting mirror image of input frequencies around 1536Hz which is unwanted.
Has anyone used this method to calculate 2N point FFT?