Sign in

Not a member? | Forgot your Password?

Search code

Search tips

Free PDF Downloads

A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

Introduction to Sound Processing

C++ Tutorial

Introduction of C Programming for DSP Applications

Fixed-Point Arithmetic: An Introduction

Cascaded Integrator-Comb (CIC) Filter Introduction

FFT Spectral Analysis Software

See Also

Embedded SystemsFPGA

DSP Code Sharing > u -Law and Inverse u-Law

u -Law and Inverse u-Law

Language: Scilab

Processor: Not Relevant

Submitted by Senthilkumar R on Mar 24 2011

Licensed under a Creative Commons Attribution 3.0 Unported License

u -Law and Inverse u-Law


 

The functions u-law and Inverse u law used to perform u-law compression and expansion

 
function [Cx,Xmax] =  mulaw(x,mu)
  //Non-linear Quantization
  //mulaw: mulaw nonlinear quantization
  //x = input vector
  //Cx = mulaw compressor output
  //Xmax = maximum of input vector x
  Xmax  = max(abs(x));
  if(log(1+mu)~=0)
    Cx = (log(1+mu*abs(x/Xmax))./log(1+mu));
  else
    Cx = x/Xmax;
  end
 
  Cx = Cx/Xmax; //normalization of output vector
endfunction

////////////////////////////////////////////////////
function x =  invmulaw(y,mu)
  //Non-linear Quantization
  //invmulaw: inverse mulaw nonlinear quantization
  //x = output vector
  //y = input vector (using mulaw nonlinear comression)
  x = (((1+mu).^(abs(y))-1)./mu)  
endfunction
 
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? )