15-02-2013, 03:50 PM
SIMULATION OF ADPCM
SIMULATION OF ADPCM.docx (Size: 17.44 KB / Downloads: 18)
ALGORITHM:
1. Start the program.
2. ADPCM quantizes the difference between the signal’s current value and its value at previous steps.
3. Predict the current value y(k) using the previous value x(k-1)
4. Generate the sawtooth signal as an original signal and decodes it.
5. Plot the graph for original and decoded signal.
6. Compute the mean square error using function, distor = sum((x-decodedx).^2)/length(x).
7. Stop the program.
PROGRAM:
clc; % Clears All Input And Output From The Command Window Display
clear all; % Removes All Variables,Funictions From Memory,Leaving The Workspace
Empty
close all; % Deletes All Figures Whose Handles Are Not Hidden.
predictor = [0 1]; % y(k)=x(k-1)
partition = [-1:.1:.9];
codebook = [-1:.1:1];
t = [0:pi/50:2*pi];
x = sawtooth(3*t); % Original signal
% QUANTIZE X USING ADPCM
encodedx = dpcmenco(x,codebook,partition,predictor);
% TRY TO RECOVER X FROM THE MODULATED SIGNAL
decodedx = dpcmdeco(encodedx,codebook,predictor);
plot(t,x,t,decodedx,'--')
legend('Original signal','Decoded signal','Location','NorthOutside');
distor = sum((x-decodedx).^2)/length(x) % Mean square error