How to calculate Krawchouk polynomials
Afficher commentaires plus anciens
This code Calculate the polynomials of Krawchouk but when I buildt the image that dosen't work help :
function [ Kw ] = polyK(N,p)%weighted Krawtchouk
%POLYK Summary of this function goes here
% Detailed explanation goes here
Kw=zeros(N,N);
w(1)= exp(N*log(1-p)) ;%the weight fuction for x=0
for x=1:1:N-1
w(x+1)=((N-x)/(x+1))*((p/(1-p)))*w(x);
end
for n=2:1:N-1
A=sqrt(((1-p)*(n+1))/(p*(N-n)));
B=sqrt(((1-p)*(1-p)*(n+1)*n)/(p*p*(N-n)*(N-n+1)));
for x=1:x:N
Kw(1,x) =sqrt(w(x));
Kw(2,x)=(1-(x/(p*N)))*sqrt(w(x));
Kw(n+1,x)=((A*((N*p)-(2*n*p)+n-x)*Kw(n,x))-(B*n*(1-p)*Kw(n-1,x)))/(p*(n-N));
end
end
end
1 commentaire
jenny jenny
le 9 Fév 2016
Réponses (0)
Catégories
En savoir plus sur Morphological Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!