› Forums › General questions › Fourier Analysis magnitude calculation
- This topic has 2 replies, 3 voices, and was last updated 3 years, 10 months ago by Brent H.
-
AuthorPosts
-
-
September 28, 2020 at 14:07 #12035
I’m having some issues understanding why we calculate magnitude in the way that we do. My understanding is that the calculation is as follows:
At each sampled point in the original signal (S1, S2, etc.), find the corresponding sample in the basis function (B1, B2, etc.) and multiply them. Sum the results of this to get the correlation value between the two signals.
AKA Sum(S1*B1, S2*B2, etc.)
But given the signals in my (rather… minimalistic) attached diagram, the original signal (top) is closer to the middle signal (Basis Function 1) than it is to the bottom one (Basis Function 2), whereas intuitively it’s much more similar to Basis Function 2.
Given the following values:
(Original signal) Flatline except at sample 2 where it has an amplitude of 10
(Basis 1) Flatline except at sample 2 where it has an amplitude of 1000.
(Basis 2) Flatline except at sample 2 where it has an amplitude of 9.The correlation with Basis 1 is (10*1000) is 10’000.
The correlation with Basis 2 is (10*9) is 90.Is my understanding of the calculation wrong, does the calculation only apply to when we use sine waves as basis functions (can we *ever* use other basis functions?), or is there some other issue here?
Thanks,
MattAttachments:
You must be logged in to view attached files. -
September 28, 2020 at 14:58 #12037
Fourier analysis only works for sinusoidal basis functions.
There are other forms of analysis that use different basis functions, but those are far less common (and far beyond the scope of Speech Processing). Even in those cases, the basis functions need to obey certain properties (e.g., arranged in a series like the sinusoids in Fourier analysis, orthogonal, etc).
Your two basis functions are actually identical (except for amplitude), so are definitely not a valid series of basis functions.
-
September 28, 2020 at 17:19 #12038
To give a more geometric analogy, suppose we have a point in a 2D vector space (I wish I could show pictures and stuff here, but following along with pencil/paper should be fine too):
x = (1,1)
We can view this vector space as having two basis vectors,
b1 = (1,0)
b2 = (0,1)so that this point can be written
(1,1) = 1*b1) + 1*b2
However, it’s not always immediately obvious what the decomposition of a point is. If our basis vectors had been
b1 = (1/sqrt(2),1/sqrt(2))
b2 = (-1/sqrt(2), 1/sqrt(2))the decomposition by basis vectors isn’t as simple as reading off the indices.
Luckily, the “dot product” can come to the rescue. Glossing over some details, the dot product between a vector x and a basis vector b gives the coefficient of b in the decomposition of x. In our example,
dot(x,b1) = 1/sqrt(2) + 1/sqrt(2) = sqrt(2)
dot(x,b2) = 1/sqrt(2) – 1/sqrt(2) = 0giving us the decomposition:
x = sqrt(2)*b1 + 0*b2
More generally, if we have a vector space with n dimensions and basis vectors b1,b2,…,bn, then a vector x decomposes as
x = dot(x,b1)*b1 + dot(x,b2)*b2 + dot(x,b3)*b3 + …
Which is pretty cool.
Going back to Fourier analysis, let’s look at another vector space. In this case, points in the vector space refer to functions. For example, if
b1 = sin(x)
b2 = sin(2x)then the point (2,3) would correspond to the function
f(x) = sin(2) + sin(3x)
In the case of Fourier analysis, the basis vectors are the basis functions
sin(x), sin(2x), etc
as in the lectures. Then to get the decomposition of a function in terms of these basis functions, we again take the dot product:
x = dot(x,b1)*b1 + dot(x,b2)*b2 + …
But what’s the dot product of two functions? It’s defined to be the integral of their product (it’s a bit more complicated than this, but let’s not get too carried away):
dot(f,g) = integral(f*g)
As we’re dealing with samples we can approximate this with sums:
dot(f,g) ~ \sum_x f(x)*g(x)
obtaining the algorithm shown in the lectures, where the the coefficients for each of the basis functions is found by multiplying the values of the basis functions and the values of the function at the sample points.
As to your original question, not every set of functions is a valid basis. For example, in our original set, the vectors b1 = (1,0) and b2 = (2,0) are not a valid basis, as they are multiples of each other, are not orthogonal, and don’t span the vector space (for example, no combination of these vectors could ever produce (0,1)). Your example is the analog in the function space, as Simon noted.
-
-
AuthorPosts
- You must be logged in to reply to this topic.