フィルターのクリア

Kernel function interpretation problem

2 ビュー (過去 30 日間)
Alessandro Ruda
Alessandro Ruda 2021 年 3 月 31 日
編集済み: Aditya Patil 2021 年 4 月 5 日
Dear MatLab comunity,
I have a distribution that I fitted with the Kernel function. See below.
A1 = load('trajrmsd_I_1_1_c.txt');
A1_RMSD = A1(:,2);
figure
[f,xi] = ksdensity(A1_RMSD);
plot(xi,f,'color','r','linewidth',2);
The point is that in the y axis i get values higher than 1. Is that normal? How is it rationalized?
All the best,
Alessandro

採用された回答

Aditya Patil
Aditya Patil 2021 年 4 月 5 日
編集済み: Aditya Patil 2021 年 4 月 5 日
As ksdensity returns the probability density, it can be higher than one. The integral of this function, which is the total probability, will be 1.
See the following code for example,
A1 = load('trajrmsd_I_1_1_c.txt');
A1_RMSD = A1(:,2);
[f,xi] = ksdensity(A1_RMSD);
plot(xi,f);
fitobj = fit(xi', f', 'linearinterp');
integralfun = @(x)(fun(x, fitobj));
integral(integralfun, 0, 2.5) % this gives integral over entire range
function y = fun(x, fitobj)
y = feval(fitobj, x)';
y = max(0, y);
end
To consider an analogous example, if you consider a rectangle with unit area, it's height can be made arbitrarily large by making the width smaller than 1 for e.g., height = 5, and width = 0.2. The area will however remain 1.

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by