# Implementation of Hilbert Spectrum in MATLAB

I am trying to implement this equation on Matlab, where i have wj values in the form of an array, cumtrapz command of MATLAB implements this, but its confusing which way is exact. such as cumtrapz(t,wj) or simply cumtrapz(wj) or manually doing it? Because results of all these though related, are different.

If $$\omega$$ is a vector with all the discrete elements $$\omega_{j}$$ over the descrete time steps $$dt$$ the correct formula would be dt*cumtrapz(omega); which is the same as cumtrapz(dt,omega) or alternatively if $$dt$$ isn't constant but $$t$$ is a vector with evaluation positions Omega=cumtrapz(t,omega,2). The "2" is needed to indicate that the 2nd vector should be integrated.