How to calculate Krawchouk polynomials
    8 ビュー (過去 30 日間)
  
       古いコメントを表示
    
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
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!