# Frequency Estimation Using Multiple Signal Classification Algorithm (MUSIC)

I'm working on side research that deals with signals and data in the time domain. currently, I want to use the multiple signal classification algorithm (MUSIC) which is mainly used for frequency estimation (I've found a lot of resources for DOA MUSIC which is not my interest). The formula of the equation is as follows:-

$$P_x{}(f) = \frac{1}{\sum\limits_{k=p+1}^{N}|s^T{}(f).v_i|^2}$$

where:-

S(f) is a complex sinusoidal vector which is represented as follows

$$e^{j2\pi kf}$$

T is the transpose of the complex vector

Vi as proposed in the book, it represents the eigenvector in the noise subspace

f is the frequency

It's the same equation in Wikipedia and the book below Wikipedia link

My main issue is I don't know what frequency values should be used in the equation (in fact I'm interested in a frequency range of the output but I don't know how it should be evaluated in the equation).

My second issue is how that could be done mathematically especially when I do the dot product between the frequency vector s(f) and the eigenvector Vi since what I've made is I've created a frequency vector of size n (same as eigenvector size) and I made the dot product between them, I'm not sure if I just need to do the dot product for a single frequency vector or all the possible values of k.

To summarize things up, I have a list of values that represents the signal i.e. 300 elements in a given time i.e. 30 seconds. and here's what I've did

1. I've created an autocorrelation matrix using the Toeplitz matrix algorithm.

2. I've computed the eigenvalues and eigenvectors of the autocorrelation matrix.

3. I've sorted the eigenvalues in descending order and then the eigenvectors based on eigenvalues.

4. I've decided the value of P, as it's described in the book in which there should be a noticed difference (huge) in the eigenvalues.

5. I've splitted the eigenvectors into principal eigenvector and noise eigenvector (we're only interested in the noise eigenvector).

6. I've created a frequency vector based on the equation for all the possible values of K for a given frequency.

7. I've made a dot product between the frequency vector and the noise eigenvector which have the same length.

Here's a pseudo-code of my implementation, but I don't think that it's correct since I don't understand the equation mathematically well:-

N <- the number of samples in the signal
P <- the inedx of the value which splits the singal into principal sinal and noise signal
SRate <- the number of samples per second in our case fps
Vi <- eigen vectors in the noise subspace
s(f) <- the complex sinusoidal vectors (frequency vector)
s(f)^T <- the transposed matrix

sig --> signal

acm <- autocorrelation matrix of sig
eval ,evec <- compute the eigen values and eigen vecotrs of acm

evec <- sort_decsending_based_on_evals(eval, evec)

v <- evec[p:N]

slices <- SRate * N

for f_i <- 0 to slices:
f = f_i / slices
ω = 2 * π * f
// constructing the frequency vector
for i <- 0 to N:
// e^(j*omega) was computed using euler's formula
s[i] <- cos (i*ω) + j sin(i*ω)

sum <- 0
for k <- p + 1 to N:
sum += | s^T . v[k] | ^ 2

res{f} <- 1/sum


This is the reference of the book in which the algorithm exists page 91 : book