Kernel estimates using Gaussian.. Its working with histogram at the moment !!
Mostrar comentarios más antiguos
Hey all...
I am trying to get the kernel work using Gaussian now.. I have it with histogram, I tried to find any relevant articles regarding the Gaussian technique in MATLAB but could not find.. I made it in different subplot to see what I am doing.. in this link it will show what I mean by Gaussian on each data plot(red dashes) rather than histogram..
https://www.ifas.jku.at/Portale/Institute/SOWI_Institute/ifas/content/e2550/e2770/e6038/files6234/JKU07HP.pdf?preview=preview
here is what I have and Its working for the histogram..
function Sa = trial(lambdaMax,lambda,T)
t = 0;
I = 0;
Sa = [];
u = rand;
t = t - log(u)/lambdaMax;
while t <= T
if (u <= lambda(t)/lambdaMax)
I = I+1;
Sa(I) = t;
end
u = rand;
t = t - log(u)/lambdaMax;
u=rand;
end
Script to run it,
lambdaMax=50;
T=20;
lambda =@(Sa) lambdaMax*(cos(Sa));
Sa = trial(lambdaMax,lambda,T);
figure
hold on
plot(Sa,lambda(Sa))
xlabel('t')
ylabel ('cos(x)')
X = linspace(min(Sa),max(Sa),100);
Y = pchip(Sa,lambda(Sa),X);
subplot(2,2,1)
plot(X,Y)
line(repmat(Sa,2,1),repmat([0;1],1,length(Sa)),'color','r' )
[f,xi] = ksdensity(Y);
subplot(2,2,2)
hist(Y)
subplot(2,2,3)
plot(xi,sum(Y)*f/sum(f),'g.-')
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Exploration and Visualization en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!