weighted average from histcount2
Hello,
I’m trying to calculate marginal spectrum(Hilbert-huang spectrum), usually HHT is 1d, in my case its 2d applying for images
I’m using histcounts2 put a,b as joint distibution
% abins and bbins in logspace, not in linspace
for i=1:lenght(imf)
a=gradient(unwrap(angle(hilbert(imf))), dx, dy))); % spatial frequency
b= hilbert(imf.’).’;% amplitude % I’m doing only in x-direction thats across columns because there is no 2d hilbert(for moment)
[jointab(:,:,i),A,B] = histcounts2(a,b,abins,bbins, "Normalization","countdensity"); % B and C are binedges
end
total=sum(jointab,3);
now I have 2d map(amplitude and spatial frequency), I want to calculate marginal spectrum(Energy vs wavenumber)
question:
1) I want to calculate amplitude weighted marginal spectrum(Energy vs wavenumber)
2) how I’m doing,
E_bin=bin centre.*total.*binwidth;
E_marginal = (sum(E_bin, 2)).^2;
is it correct normalization?
is binwidth=dB*dC or only dB?
am I missing something here,
3) is countdensity is correct normalization for logspace binwidth, if I take pdf or probability, how my normalization changes
4) how to verify final result?
Thank you, I’m looking forward to hear someone opinion, if it is not clarity, please let me know,
Regards,
KCHello,
I’m trying to calculate marginal spectrum(Hilbert-huang spectrum), usually HHT is 1d, in my case its 2d applying for images
I’m using histcounts2 put a,b as joint distibution
% abins and bbins in logspace, not in linspace
for i=1:lenght(imf)
a=gradient(unwrap(angle(hilbert(imf))), dx, dy))); % spatial frequency
b= hilbert(imf.’).’;% amplitude % I’m doing only in x-direction thats across columns because there is no 2d hilbert(for moment)
[jointab(:,:,i),A,B] = histcounts2(a,b,abins,bbins, "Normalization","countdensity"); % B and C are binedges
end
total=sum(jointab,3);
now I have 2d map(amplitude and spatial frequency), I want to calculate marginal spectrum(Energy vs wavenumber)
question:
1) I want to calculate amplitude weighted marginal spectrum(Energy vs wavenumber)
2) how I’m doing,
E_bin=bin centre.*total.*binwidth;
E_marginal = (sum(E_bin, 2)).^2;
is it correct normalization?
is binwidth=dB*dC or only dB?
am I missing something here,
3) is countdensity is correct normalization for logspace binwidth, if I take pdf or probability, how my normalization changes
4) how to verify final result?
Thank you, I’m looking forward to hear someone opinion, if it is not clarity, please let me know,
Regards,
KC Hello,
I’m trying to calculate marginal spectrum(Hilbert-huang spectrum), usually HHT is 1d, in my case its 2d applying for images
I’m using histcounts2 put a,b as joint distibution
% abins and bbins in logspace, not in linspace
for i=1:lenght(imf)
a=gradient(unwrap(angle(hilbert(imf))), dx, dy))); % spatial frequency
b= hilbert(imf.’).’;% amplitude % I’m doing only in x-direction thats across columns because there is no 2d hilbert(for moment)
[jointab(:,:,i),A,B] = histcounts2(a,b,abins,bbins, "Normalization","countdensity"); % B and C are binedges
end
total=sum(jointab,3);
now I have 2d map(amplitude and spatial frequency), I want to calculate marginal spectrum(Energy vs wavenumber)
question:
1) I want to calculate amplitude weighted marginal spectrum(Energy vs wavenumber)
2) how I’m doing,
E_bin=bin centre.*total.*binwidth;
E_marginal = (sum(E_bin, 2)).^2;
is it correct normalization?
is binwidth=dB*dC or only dB?
am I missing something here,
3) is countdensity is correct normalization for logspace binwidth, if I take pdf or probability, how my normalization changes
4) how to verify final result?
Thank you, I’m looking forward to hear someone opinion, if it is not clarity, please let me know,
Regards,
KC histcount2, histogram, digital image processing, hilbert, hht, hilbert–huang transform MATLAB Answers — New Questions