Fisher ratio or F_ratio I am confused while writing code to implement Fisher’s F-ratio.

Suppose I have 4 speakers, each speaker pronounces 2 words and each word has 3 frames and each frame has 30 sub-bands.

$u$ is mean of all speakers.

Suppose $x_{ij}$ is one sub-band energy of the $j$th speech frame of
speaker $i$ with $j= 1\ldots N$, and $i = 1 \ldots M$. $u_i$ and
$u$ are the sub-band energy averages for speaker $i$ and for
all speakers, respectively, which are defined as 
$$
u = \frac{1}{MN} \sum_{i=1}^{M}\sum_{j=1}^N x_{ij}\\
u_i = \frac{1}{N} \sum_{j=1}^N x_{ij}
$$
I have written following MATLAB code: 

U=mean(mean(mean(mean(spectr1(:,:,:,:)))));
for subband=1:N
nominator=0;
for speaker=1:speaker_number
   nominator=(mean(mean(spectr1(speaker,:,:,subband)))-U).^2+nominator;
end
denaminator=0;
denaminator=(mean(mean(mean(spectr1(:,:,:,subband))))-mean(mean(spectr1(speaker,:,:,subband)))).^2;
F_ratio(subband)=((1/speaker_number)*(nominator))/((1/(speaker_number*phonem_number))*denaminator);
end
Well, check out Wikipedia.

The ratio is defined as:

$$
F = \frac{\mathrm{between-group\ variability}}{\mathrm{within-group\ variability}}
$$

where, using your notation, they say that the between-group variability is:

$$
\sum_{i=1}^{M} (u_i - u)^2/(M -1)
$$

and the within-group variability is:

$$
\sum_{i=1}^{M} \sum_{j=1}^{N}( x_{ij} - u_i )^2 / (N - M)
$$