Hi there,
I have been working through the Matlab function fir2 –
I'm converting it to C++ line by line.
I'm currently at the following section in the m-file where it performs the Fourier Time Shift –
% Fourier time-shift.
dt = 0.5 .* (nn – 1) rad = -dt .* sqrt(-1) .* pi .* (0:npt-1) ./ (npt-1);
I can find dt, ok.
But for rad, I'm getting 'NaN', due to the sqrt(-1) operation. So I'm thinking I need to be handling the imaginary \ complex number here with something like std::complex
I'm reading this part of the matlab code as something equivalent to this in C –
!!! Please see attached file as I couldnt write formatted C++ code here.. Thanks !!!
The C++ output looks ok for the imaginary part, but the real part is non zero, and also negative. So I must be doing something wrong here..
Any ideas?
Thanks in advance
Best Answer