Sign in

username or email:

password:



Not a member?
Forgot your password?

Search code



Search tips

Ads

See Also

Embedded SystemsFPGA

DSP Code Sharing > PCM Encoding-Converting Quantized decimal sample values in to binary

PCM Encoding-Converting Quantized decimal sample values in to binary

Language: Scilab

Processor: Not Relevant

Submitted by Senthilkumar R on Mar 24 2011

Licensed under a Creative Commons Attribution 3.0 Unported License

PCM Encoding-Converting Quantized decimal sample values in to binary


 

Converting Quantized decimal sample values in to binary.

 
function [c] = PCM_Encoding(x,L,en_code)
  //Encoding: Converting Quantized decimal sample values in to binary
   //x = input sequence
   //L = number of qunatization levels
   //en_code = normalized input sequence
n = log2(L);
c = zeros(length(x),n);
for i = 1:length(x)
  for j = n:-1:0
    if(fix(en_code(i)/(2^j))==1)
      c(i,(n-j)) =1;
      en_code(i) = en_code(i)-2^j;
    end
  end
end
disp(c)
 
Rate this code snippet:
0
Rating: 0 | Votes: 0
 
   
 
posted by Senthilkumar R



Comments


No comments yet for this code


Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )