Error in complex multiplication
Show older comments
I am trying to load information on just one subcarrier while doing an IFFT. Then, I am trying to bring the subcarrier to DC by multiplying it with a complex exponential of corresponding frequency. In doing so I am able to extract the DC from the real component, but my imaginary component is getting garbage values and thus gives a randomly increasing phase.Is it a MATLAB computational error? Is there any way to fix this?
clear all
ifft_size = 128;
ifft_in = zeros(ifft_size,1);
% Load subcarrier number 16 with data
ifft_in(17,1) = 1;
% Compute IFFT
ifft_out = ifft(ifft_in,ifft_size);
x = ifft_out(:);
% Bring the signal to DC
num_samp = numel(x);
y = x.*exp(-1i*2*pi*16*(0:num_samp-1)/ifft_size).';
figure;plot(real(y));
figure;plot(imag(y));
xlabel('Subcarrier index');ylabel('Imag(y)');

Accepted Answer
More Answers (0)
Categories
Find more on Transforms 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!