1
votes

I have a set of signals S1, S2, ....,SN, for which I am numerically computing the Fourier transforms F1, F2, ,,,,FN. Where Si's and Fi's are C++ vectors (my computations are in C++).

My Computation objective is as follows:

  1. compute product: F = F1*F2*...*FN

  2. inverse Fourier transform F to get a S.

What I numerically observe is when I am trying to compute the product either I am running into situation where numbers become too small. Or numbers become too big.

I thought of scaling F1 by say a1 so that the overflow or underflow is avoided.

With the scaling my step 1 above will become

F' = (F1/a1)*(F2/a2)*...*(FN/aN) = F'1*F'2*...*F'N

And when I inverse transform my final S' will differ from S by a scale factor. The structural form of the S will not change. By this I mean only the normalization of S is different.

My question is :

  1. Is my rationale correct.

  2. If my rationale is correct then given a C++ vector "Fi" how can I choose a good scale "ai" to scale up or down the Fi's.

Many thanks in advance.

1
Your question might be better suited for Mathematics Stack Exchange.Ron
What data types are you using (floats? doubles? long doubles? ints?)? Can you show us at least a bit of code?metal
Are you doing complex multiplications?Commodore63
yes, the numerical recipes fft routine which I am using puts real and complex parts of the numbers side by side i.e. N complex numbers are put in a vector of size 2N. After I get the output from the fft routine, I do perform complex multiplications.user1612986

1 Answers

0
votes

You can change the range of the Fi vector in a new domain, let's say [a, b]. So from your vector Fi, the minimum number will become a and the maximum number will become b. You can scale the vector using this equation:

Fnew[i] = (b-a)/(max-min) * (F[i] - min) + a,

where: min = the minimum value from F max= the maximum value from F

The only problem now is choosing a and b. I would choose [1,2], because the values are small (so you won't get overflow easily), but not smaller than 0.