MATLAB code for quantization To load a.wav file into MATLAB use the wavread command: Y=wavread(‘filename.wav’); To quantize this signal to n bits, use the function p2Quantize: Yquant=p2Quantize(Y,n); To save this quantized signal as a.wav with sampling frequency Fs, use the wavwrite command: wavwrite(Yquant,Fs,’filename.wav’); Note: all the sound files used in this demo have a sampling frequency of 11025 Hz. Below are links to the code for the function p2Quantize. This function uses the class fixed, which is also provided.
Business Ethics Concepts and Cases 6th edition by Velasquez, Manuel G. Published by PHI Learning Paperback on Amazon.com. *FREE* shipping on qualifying offers. Business ethics manuel g velasquez 6th edition. Velasquez: Business Ethics: Concepts & Cases Sixth (6th) Edition on Amazon.com. *FREE* shipping on qualifying offers. Business Ethics Concepts and Cases Sixth Edition [Manuel G. Velasquez] on Amazon.com. *FREE* shipping on qualifying offers.
He invented the process, later familiar as the 'blueprint'. British chemist made many contributions to the new field. Buku bahasa indonesia erlangga. Talbot's famous tiny paper negative of the Oriel window in, one of a number of camera photographs he made in the summer of 1835, may be the oldest camera negative in existence.
Source Coding Represent Partitions Scalar quantization is a process that maps all inputs within a specified range to a common value. This process maps inputs in a different range of values to a different common value. In effect, scalar quantization digitizes an analog signal. Two parameters determine a quantization: a and a. A quantization partition defines several contiguous, nonoverlapping ranges of values within the set of real numbers.
To specify a partition in the MATLAB ® environment, list the distinct endpoints of the different ranges in a vector. For example, if the partition separates the real number line into the four sets.
Codebook = -1, 0.5, 2, 3; is one possible codebook for the partition 0,1,3. Determine Which Interval Each Input Is In The quantiz function also returns a vector that tells which interval each input is in. P90x shoulders and arms download avi. For example, the output below says that the input entries lie within the intervals labeled 0, 6, and 5, respectively. Here, the 0th interval consists of real numbers less than or equal to 3; the 6th interval consists of real numbers greater than 8 but less than or equal to 9; and the 5th interval consists of real numbers greater than 7 but less than or equal to 8. Partition = 3,4,5,6,7,8,9; codebook = 3,3,4,5,6,7,8,9; index,quants = quantiz(2 9 8,partition,codebook); Optimize Quantization Parameters.
Section Overview Quantization distorts a signal. You can reduce distortion by choosing appropriate partition and codebook parameters. However, testing and selecting parameters for large signal sets with a fine quantization scheme can be tedious.
One way to produce partition and codebook parameters easily is to optimize them according to a set of so-called training data. Note The training data you use should be typical of the kinds of signals you will actually be quantizing. Example: Optimizing Quantization Parameters The lloyds function optimizes the partition and codebook according to the Lloyd algorithm. The code below optimizes the partition and codebook for one period of a sinusoidal signal, starting from a rough initial guess. Then it uses these parameters to quantize the original signal using the initial guess parameters as well as the optimized parameters. The output shows that the mean square distortion after quantizing is much less for the optimized parameters.
The quantiz function automatically computes the mean square distortion and returns it as the third output parameter. Ans = 0.0148 0.0024 Differential Pulse Code Modulation. Section Overview The quantization in the section requires no a priori knowledge about the transmitted signal. In practice, you can often make educated guesses about the present signal based on past signal transmissions. Using such educated guesses to help quantize a signal is known as predictive quantization. The most common predictive quantization method is differential pulse code modulation (DPCM). The functions dpcmenco, and dpcmopt can help you implement a DPCM predictive quantizer with a linear predictor.
DPCM Terminology To determine an encoder for such a quantizer, you must supply not only a partition and codebook as described in and, but also a predictor. The predictor is a function that the DPCM encoder uses to produce the educated guess at each step. A linear predictor has the form. Note The initial zero in the predictor vector makes sense if you view the vector as the polynomial transfer function of a finite impulse response (FIR) filter.
Example: DPCM Encoding and Decoding A simple special case of DPCM quantizes the difference between the signal's current value and its value at the previous step. Thus the predictor is just y(k) = x (k - 1). The code below implements this scheme. It encodes a sawtooth signal, decodes it, and plots both the original and decoded signals.
The solid line is the original signal, while the dashed line is the recovered signals. The example also computes the mean square error between the original and decoded signals. Note The training data you use with dpcmopt should be typical of the kinds of signals you will actually be quantizing with dpcmenco. Example: Comparing Optimized and Nonoptimized DPCM Parameters This example is similar to the one in the last section.
However, where the last example created predictor, partition, and codebook in a straightforward but haphazard way, this example uses the same codebook (now called initcodebook) as an initial guess for a new optimized codebook parameter. This example also uses the predictive order, 1, as the desired order of the new optimized predictor. The dpcmopt function creates these optimized parameters, using the sawtooth signal x as training data. The example goes on to quantize the training data itself; in theory, the optimized parameters are suitable for quantizing other data that is similar to x. Notice that the mean square distortion here is much less than the distortion in the previous example. Distor = 0.0063 Compand a Signal. Section Overview In certain applications, such as speech processing, it is common to use a logarithm computation, called a compressor, before quantizing.
The inverse operation of a compressor is called an expander. The combination of a compressor and expander is called a compander. The compand function supports two kinds of companders: µ-law and A-law companders.
Its reference page lists both compressor laws. Example: µ-Law Compander The code below quantizes an exponential signal in two ways and compares the resulting mean square distortions. First, it uses the function with a partition consisting of length-one intervals.
In the second trial, implements a µ-law compressor, quantiz quantizes the compressed data, and compand expands the quantized data. The output shows that the distortion is smaller for the second scheme. This is because equal-length intervals are well suited to the logarithm of sig, but not well suited to sig. The figure shows how the compander changes sig. Mu = 255;% Parameter for mu-law compander sig = -4.1:4; sig = exp(sig);% Exponential signal to quantize V = max(sig);% 1. Quantize using equal-length intervals and no compander. index,quants,distor = quantiz(sig,0:floor(V),0:ceil(V));% 2.
Use same partition and codebook, but compress% before quantizing and expand afterwards. Compsig = compand(sig,Mu,V, 'mu/compressor'); index,quants = quantiz(compsig,0:floor(V),0:ceil(V)); newsig = compand(quants,Mu,max(quants), 'mu/expander'); distor2 = sum((newsig-sig).^2)/length(sig); distor, distor2% Display both mean square distortions. Plot(sig);% Plot original signal. Hold on; plot(compsig,'r-');% Plot companded signal. Legend('Original','Companded','Location','NorthWest') The output and figure are below. Note For long sequences from sources having skewed distributions and small alphabets, arithmetic coding compresses better than Huffman coding. To learn how to use arithmetic coding, see.
Create a Huffman Code Dictionary in MATLAB Huffman coding requires statistical information about the source of the data being encoded. In particular, the p input argument in the huffmandict function lists the probability with which the source produces each symbol in its alphabet. For example, consider a data source that produces 1s with probability 0.1, 2s with probability 0.1, and 3s with probability 0.8.
The main computational step in encoding data from this source using a Huffman code is to create a dictionary that associates each data symbol with a codeword. The commands below create such a dictionary and then show the codeword vector associated with a particular value from the data source. Sig = repmat(3 3 1 3 3 3 3 3 2 3,1,50);% Data to encode symbols = 1 2 3;% Distinct data symbols appearing in sig p = 0.1 0.1 0.8;% Probability of each data symbol dict = huffmandict(symbols,p);% Create the dictionary.
Hcode = huffmanenco(sig,dict);% Encode the data. Dhsig = huffmandeco(hcode,dict);% Decode the code.
Arithmetic Coding. Section Overview Arithmetic coding offers a way to compress data and can be useful for data sources having a small alphabet. The length of an arithmetic code, instead of being fixed relative to the number of symbols being encoded, depends on the statistical frequency with which the source produces each symbol from its alphabet.
For long sequences from sources having skewed distributions and small alphabets, arithmetic coding compresses better than Huffman coding. The arithenco and arithdeco functions support arithmetic coding and decoding. Represent Arithmetic Coding Parameters Arithmetic coding requires statistical information about the source of the data being encoded. In particular, the counts input argument in the arithenco and arithdeco functions lists the frequency with which the source produces each symbol in its alphabet. You can determine the frequencies by studying a set of test data from the source. The set of test data can have any size you choose, as long as each symbol in the alphabet has a nonzero frequency.
For example, before encoding data from a source that produces 10 x's, 10 y's, and 80 z's in a typical 100-symbol set of test data, define. Quantized = Columns 1 through 6 -1.0000 -1.0000 -1.0000 -1.0000 0.5000 0.5000 Columns 7 through 12 2.0000 2.0000 2.0000 2.0000 2.0000 3.0000 Column 13 3.0000 Scalar Quantization Example 2 This example illustrates the nature of scalar quantization more clearly. After quantizing a sampled sine wave, it plots the original and quantized signals. The plot contrasts the x's that make up the sine curve with the dots that make up the quantized signal. The vertical coordinate of each dot is a value in the vector codebook.
Copyright (c) 2010, Peter Robert All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:.
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Uniform Quantization Of Images
By observing the name we think this is a modulation process but in reality this a one type of A to D conversion mechanism i.e. Analog to digital conversion technique.
Beside this technique we have lot of methods like delta modulation, differential pulse code modulation, adaptive delta modulation, adaptive differential pulse code modulation etc in digital communications. There is always a trade of between all these methods we compare all these based on the bit rate, circuit implementation, and bandwidth. PCM uses lot of operations to convert analog signal to digital signal so the technique is complex. At the receiver side we employ sampling, quantizing, encoding. Generally the two process named as encoding and quantizing are done in the same circuit known as analog to digital converter i.e.
A to D converter. The operations done in the receiver circuit are regeneration of the received signal, decoder, and reconstruction or regeneration. All these operations are performed on the quantized samples. All these operations are done in the same circuit which is digital to analog converter i.e.
D to A converter. We know that in the process of transmission we face lot of problems with atmospheric noise and distortion and filtering action of the channel. To combat all these effects we employ regenerating repeaters in the channel to reconstruct and re transmit the coded pulses which are in the way to the receiver.
This is time to deal all the processes used in the PCM. A PCM stream is a digital representation of an analog signal, in which the magnitude of the analog signal is sampled regularly at uniform intervals, with each sample being to the nearest value within a range of digital steps. This is the standard form used for digital audio in computers, CD and DVD formats. PCM has two properties namely sampling rate and bit depth we all know about sampling rate bit depth refers to the number of digital values that the each sample can take.
Quantization error is the main drawback of PCM. Digital communications requires sampling which is first step in all A to D converters. The sampling is done according to the Nyquist criterion. We may define the process of sampling as a band-limited signal of finite energy, which has no frequency components higher than W hertz, may be completely recovered from the knowledge of its samples taken at the rate of 2W per second. The other definition is a band-limited signal of finite energy, which has no frequency components higher than W hertz, is completely described by specifying the values of the signal at instants of time separated by seconds. We use these to definitions at the receiver and transmitter. The sampling rate 2W is called the Nyquist rate.
And its inverse is called the Nyquist interval. To make the signal as the band limited signal we incorporate the low pass filter at the beginning of the transmitter known as the anti-aliasing filter which stops or attenuates the high frequency components which lie outside the desired frequency band. Then the filtered signal is sampled at a rate higher than the Nyquist rate. A circuit known as the sample and hold circuit is used in sampling to produce the flat top sampling. Flat top sampling provides us to use simple quantizing strategy.
Over sampling is used to reduce the distortion in most of the analog to digital converters. Quantization in DSP represents the process which maps the large set values to a single value. A circuit which performs this operation is called the quantizer. This process is also introduces some errors in the signal this is called quantization error or rounding of error.
This is a non linear process because this is many to one mapping function. Quantized sample has discrete nature in both time and amplitude. Quantizers are of two types namely uniform and non uniform. In uniform quantization step size is constant while in non uniform quantization step size is varied according to the amplitude of the signal.
To perform non uniform quantization one needs to pass the signal into the compressor and then into the uniform quantizer. Non uniform quantization takes care of both high and small variations in the amplitude levels of the signal. We have two laws to perform the quantization they are A-law and µ-law. In the receiver we perform the inverse operation of the quantizer in this we send the received signal into the expander. The device which can perform both operations of expansion and compression is called compander. Encoding is done to transmit the signal obtained by the combined effect of the sampling and quantizing over the channel which has undesired characteristics.
The signal obtained from the sampling and quantizing is not suitable for transmission as it is over a telephone line i.e. Copper pair or radio or microwave link. To combat with the channel impairments we use encoding process. For this we use different types of coding techniques. Encoding process is a one to one representation.
A particular arrangement of symbols used in a code to represent a single value of the discrete set is called a code word or character. In a binary code each symbol may be represented by the any two levels of presence of pulse or absence of pulse. Binary wave is robust to noise and easy to regenerate. For example in a binary code each sample is represented with the n number of bits then we can represent the total of 2 n discrete levels.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |