Penghitung korelasi dan rate of distrotion dari PCM dan DPCM Penghitung distorsi untuk ADPCM

1. Penghitung korelasi dan rate of distrotion dari PCM dan DPCM

========================================================= clear; close all; clc; ========================================================= function [R,H]=countDistnama_file,D Program penghitung korelasi dan rate of distortion load data; e=2.7283; Dn=10.D.10; nama_file=[a i u e o] nama_file=[p]; [y,fs,nbits]=wavreadnama_file; if fs=8000 inc=roundfs8000; fs=8000; Sub sampling menjadi 8000 y=y1:inc:lengthy; wavplayyin,8000 else errorfs is lower than 8 Khz, Please use Fs=8 Khz; end y=y.8192; source untuk DPCM u=[y;0]; v=[0;y]; d=u-v; Hitung korelasi ryy=xcorry,y; rdd=xcorrd,d; x1=lengthryy-12; delay1=[-x1:1:x1]; x2=lengthrdd-12; delay2=[-x2:1:x2]; koefisien korelasi rhoyy=ryymaxryy; Normalisasi rhodd=rddmaxrdd; Normalisasi hitung probabilitas proby=histy,256lengthy; probd=histd,256lengthd; proby=probyfindproby~=0; probd=probdfindprobd~=0; hitung entropy sumber Hy=sumproby.log10probylog102; Hd=sumprobd.log10probdlog102; H=[Hy;Hd]; hitung lower bound untuk rate of distortion dari Shannon RDy=Hy-0.5.log102pi.e.Dn; RDd=Hd-0.5.log102pi.e.Dn; R=[RDy;RDd]; RFS=R.fs; ploting autocorellation subplot211;plotdelay1,rhoyy; xlabelshift;ylabelCoefficient of Correlation; titleAutocorrellation of source signal for PCM; grid on; subplot212;plotdelay2,rhodd; xlabelshift;ylabelCoefficient of Correlation; titleAutocorrellation of source signal for DPCM; grid on; figure;subplot211;plotDlog,RDy,-,Dlog,RDd,:ro; ylabelRDbitsyimbol; xlabeldistortion D db; titleShanon Lower Bound for Rate of Distortion RDFunction; legendPCM source,DPCM source; grid on; subplot212;plotDlog,RFS1,:,-,Dlog,RFS2,:,:ro; ylabelRDbitsecond; xlabeldistortion D db; fs=fs1000; t=sprintfSampling Rate=.2f Khz,fs; titlet; legendPCM source,DPCM source; grid on;

2. Penghitung distorsi untuk ADPCM

function [Dlog,D,e,e2]=Distortionnama_file,N program penghitung distorsi untuk ADPCM baca file [yin,fs]=wavreadnama_file; if fs =8000 inc=roundfs8000; fs=8000; sub sampling menjadi 8000 yin=yin1:inc:lengthyin; wavplayyin,8000; else errorFs is lower than 8 Khz, Please use Fs = 8 Khz; end; y14=yin.8192; masukan ke enkoder ADPCM [I,sr,dout,dqout,yout,aiout,biout.tdout,trout,alout]=adpcmy14,N; yout=sr.8192; wavplayyout,8000; hitung distorsi e=yin-yout; e2=e.2; D=meane2; Dlog=10log10D;

3. Program ADPCM dengan standar G. 726