Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Huffman encoding

  1. Jan 11, 2007 #1

    ppp

    User Avatar

    My source is exp(-x) and I would like to compute the probability vector so as to use in huffman function for (N=4 bits).

    [code,len]=Huffman(p)

    May someone help me ???
    I don't know hot can I find the probability vercto.

    Thanks
     
  2. jcsd
  3. Jan 11, 2007 #2
    Lets say that you have n different symbols making up m symbols worth of sample data. The probability for each symbol is the number of occurances of n divided by m. The probability vector is just a vector of all of these probabilities (one for each symbol).

    For 4-bit symbols you have 2^4 = 16 symbols. Suppose that you have the following trivial example:

    0001 0010 0011 1000 1001 0011 0001

    then the probability vector would be (column vector)

    2/7
    1/7
    2/7
    0
    0
    0
    0
    1/7
    1/7
    0
    0
    0
    0
    0
    0

    Hope this helps.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Huffman encoding
  1. Huffman Code. (Replies: 4)

Loading...