Mathematical formula of a function

1 visualización (últimos 30 días)
Kelvin Prado
Kelvin Prado el 6 de Ag. de 2016
Editada: Stephen23 el 7 de Ag. de 2016
Hello,
I have a Matlab function created based on the Chi Square Periodogram from Sokolove and Bushell, but with some modifications:
x = [4054,0,237,2009,4001,...,906,851,1134,3688]
passo = 1 % Step
freqmin = 1200 % Minimum Frequency
freqmax = 1600 % Maximum Frequency
aux=1;
% Goes from the min frequency to the max frequency, alternating by the step
for j=freqmin:passo:freqmax
% Creates a matrix based on the current frequency
for i=1:length(x)/j
if i==1
d(1,:)=x(i:i*j);
else
d(i,:)=x(((i-1)*j)+1:i*j);
end
end
% Converts the matrix to a vector and calculates the average
[row,col]=size(d);
tt=reshape(d,1,row*col);
xmedia=nanmean(tt);
% (Mh-M)^2
xaux=(tt-xmedia).^2;
% The denominator will be the average of the previous vector (xaux)
denominador=nanmean(xaux);
% Calculates an average of each column in the matrix and creates a vector with its results
daux= nanmean(d,1);
% ((Xi-M)^2) / N
dnumerador= nansum((daux-xmedia).^2)/length(faux);
% Calculates the Qp of the current frequency
Qp(aux)=dnumerador/denominador;
xAxis(aux)=j
aux=aux+1;
clear d
end
Can someone confirm to me if the following mathematical formula is correct and represents the function?
p = Current period length
N = Data length
Xi = Current data
M = Average of all data
Mh = Each data of the current period
Note: maybe this is not the right place to ask that but I really need to confirm that.

Respuestas (1)

Star Strider
Star Strider el 6 de Ag. de 2016
Editada: Stephen23 el 7 de Ag. de 2016
It would help to know what the variables are. It looks like ‘Qp’ is a ratio of variances, but beyond that I’ve not a clue. I have no idea how it relates to your code, because you have not documented any of it.
Is there a context we should know?
  2 comentarios
Kelvin Prado
Kelvin Prado el 6 de Ag. de 2016
Thanks Star Strider.
Actually, this is not my function, I just created the mathematical formula based on it.
I know this function is based on the following work: "The chi square periodogram: its utility for analysis of circadian rhythms.".
And I think the original formula is:
that can be found on the link: http://132.187.25.13/actogramj/manual.html
I commented the code in the question to help.
Star Strider
Star Strider el 6 de Ag. de 2016
The easiest way to determine if your code is correct is if the result of your calculation is the same as that produced by the software.
The equation is straightforward to implement (your software calculates it automatically), but I have no idea what your data are, their format, or what you’re doing with them. Without that, I can’t determine if your code is correct or not.
I duplicated and expanded on the link in a separate comment to your original post.

Iniciar sesión para comentar.

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by