1 % get_prob - implementation of p(x,s)
4 % [value index]=get_prob(x,features,sigma)
6 % s - natural number, a height value for which the probability is
8 % features - parameters of the underlying distribution - odd items
9 % are mu_i, even are k_i
10 % sigma - variance of a single part of the underlying distribution
13 % value - value=max{k_i*N(mu_i,sigma)} over all i's, where
14 % N denotes normal distribution
15 % k_i are even items of vector 'features',
16 % mu_i are odd items of vector 'features' and
17 % sigma is the variance of a single gaussian
18 % index - index=argmax{k_i*N(mu_i,sigma)} over all i's, where all the
19 % symbols have the same meaning as they have for the previous output
22 function[value index]=get_prob(s,features,sigma)
26 features=features(features>0);
33 ex=((s-mu).^2)/(2*sigma^2);
35 index=find(tmp==max(tmp),1);
36 %value=k(index)*(1/(sqrt(2*3.14159)*sigma))*exp(tmp(index));
37 value=k(index)*(1/sigma)*exp(tmp(index));
42 %for i=1:2:length(features)
44 % p=features(i+1)*normpdf(s,features(i),sigma);
53 % index=find(abs(features(1:2:end)-s)==min(abs(features(1:2:end)-s)),1,'first');