How to get kse or ksdensity as definable or anonymous function of x
24 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
David Gillcrist
el 1 de Oct. de 2024 a las 16:40
From what I can tell both kse and ksdensity are used to get a smoothly defined probability distribution function from vector of finite data. Is there a way to get MATLAB to produce the actual function as the output instead of finite set of input/output vectors? I need to be able to call on the kernal density estimator at an arbitrary point in my domain and I'd prefer not to just interpolate between the values provided. Is there a functionality of either of these two that gives the true function/estimator or do I need to write my own code to accomplish this?
3 comentarios
Torsten
el 1 de Oct. de 2024 a las 18:20
Editada: Torsten
el 1 de Oct. de 2024 a las 18:22
You can define the function as
f = @(y) ksdensity(x,y)
e.g.
rng('default') % For reproducibility
x = [randn(30,1); 5+randn(30,1)];
f = @(y)ksdensity(x,y);
fy = f(1.34)
Of course, the density function will always be recomputed this way.
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!