Digital Signal Processing Lab Report 6
Submitted by Name Allam Levi Ratnakar B Suresh Roll Number 08EEB025 08EEB026
Problem:
Design a model for the plant h (z) =0.2600+0.9300z¯¹+0.2600z¯² using direct modeling (Adaptive Algorithm LMS/RMS). The channel is associated with the following functions.
where p(k) is the output of each of linear part of the channels
Theory:
The aim of this experiment is to create a model for a plant with given parameters using direct modeling for the given different functions.
Given
H (z) =0.2600+0.9300z¯¹+0.2600z¯²
Matlab code for the given problem:
Main program is given below whereas subroutines aregiven after this program ends. inp = randn(1,502); p = [0.26 0.93 0.26]; snr = input('enter snr \n'); x=rand(10,30); for i=1:10 for j=1:30 if x(i,j)>0.5 x(i,j)=1; else x(i,j)=0; end end
end for i=1:10 a(i,:)=x(i,1:10); b(i,:)=x(i,11:20); c(i,:)=x(i,21:30); end for i=1:10 wt(i,:)=[bin2deci(a(i,:)) bin2deci(b(i,:)) bin2deci(c(i,:))]; end for n=1:20 for i=1:10 for j=1:500 X(1:3) = inp(j:j+2); Y1(i,j) = X*p'; sp(j) = rms(X); noise(i,j) = sqrt(sp(j)*(10^(-snr/10))); Y2(i,j)=tanh(Y1(i,j)+noise(i,j)); Y3(i,j) = X*wt(i,:)'; er1(i,j) = Y2(i,j)-Y3(i,j); ers1(i,j)=er1(i,j)*er1(i,j); end ermax(i,:) = max(ers1(i,:)); MSE(i,:) = 0.5*db(sum(ers1(i,:))/ermax(i,:)); end T=[wt a b c MSE]; T1=sortrows(T,34);
T2=T1(1:8,:); wt1=T2(:,1:3); a1=T2(:,4:13); b1=T2(:,14:23); c1=T2(:,24:33);
coa= crossover(a1); cob= crossover(b1); coc= crossover(c1);
mua= mutation(coa); mub= mutation(cob); muc= mutation(coc);
a2=[a1; coa; mua]; b2=[b1; cob; mub]; c2=[c1; coc; muc];
for i=1:24 wt2(i,:)=[bin2deci(a2(i,:)) bin2deci(b2(i,:)) bin2deci(c2(i,:))]; end
for i=1:24 for j=1:500 X1(1:3) = inp(j:j+2); Y21(i,j) = X1*p';
sp1(j) = rms(X1); noise1(i,j) = sqrt(sp1(j)*(10^(-snr/10))); Y22(i,j)=tanh(Y21(i,j)+noise1(i,j)); Y23(i,j) = X1*wt2(i,:)'; er2(i,j) = Y22(i,j)-Y23(i,j);