Hello, I've a problem with the function mvnpdf. The error is: SIGMA must be a square, symmetric, positive definite matrix. But for me SIGMA is square, symmetric and positive. This is my code for bayesian classifier:
m=size(T{1},2);M=zeros(K,m);Sig=zeros(m,m,K);n=zeros(1,K);for k=1:K X=T{k}; n(k)=size(X,1); M(k,:)= mean(X); Sig(:,:,k)=cov(X);endp=n/sum(n); LV=[];LC=[]; m=length(S); for j=1:m LV=[LV;k]; x=S(j,:); pdf=[]; for l=1:K pdf=[pdf mvnpdf(x,M(l,:),Sig(:,:,l))]; end P=p.*pdf; [v e]=max(P); LC=[LC; e]; end
The values and dataset are in memory. Can someone please help me? Thanks.
Best Answer