clear; clc; close all; % hint: the mathimatical relationships of DPD coefficients interms of the % PA coefficients and the input signal power. Here, we consider the % even nonlinearity order terms are canceled by filtering, also we assume the index % of the PA is started by 1 not 0, furthermore we consider the nonlinearity % index k=2n-2, (i.e. a_k,m in the paper =a_n,m in this code where n=(k+2)/2) K=3; % nonlinearity order M=1; % number of memory taps N=(K+1)/2; % the effective nonlinearity terms A = sym('a', [N M],'real'); % PA cofficients U = flip(sym('u', [(M+(M-1)) 1],'real')); % the index indicate the time index V = flip(sym('v', [(M+(M-1)) 1],'real')); % the index indicate the time index %% for m=1:M for r=1:N B(r,:)=abs(conj((U(1+(m-1):(end+(m-1)-(M-1)))+1i*V(1+(m-1):(end+(m-1)-(M-1))))')).^(2*r-2); end w(1,m)=expand(sum(B.*A*(U(1+(m-1):(end+(m-1)-(M-1)))+1i*V(1+(m-1):(end+(m-1)-(M-1))))));% PA output equation end %% construct Y matrix for r=1:N y(1,(M*(r-1)+1):r*M)=w.*((abs(w)).^(2*(r-1))); end yy=expand(y'*y);% (Y^H)*Y yx=expand(y'.*(U(1)+1i*V(1)));% (Y^H)*X YY=expand(rewrite(yy,'sqrt')); YX=expand(rewrite(yx,'sqrt')); %% taking the mathematical expectation using equation (60) sigma = sym('sigma','positive'); YYsub = YY; YXsub = YX; for g=1:N*M for h=1:N*M for t=1:4*K for r=1:length(U) YYsub(g,h)=subs(YYsub(g,h),U(r)^(2*t),prod(1:2:2*t)*sigma^(2*t)); YYsub(g,h)=subs(YYsub(g,h),V(r)^(2*t),prod(1:2:2*t)*sigma^(2*t)); end end end end for g=1:N*M for h=1:N*M for t=1:4*K for r=1:length(U) YYsub(g,h)=subs(YYsub(g,h),U(r)^(2*t-1),0); YYsub(g,h)=subs(YYsub(g,h),V(r)^(2*t-1),0); end end end end %% substitute by E(u^odd)=E(v^odd)=0 for g=1:N*M for t=1:4*K for r=1:length(U) YXsub(g,1)=subs(YXsub(g,1),U(r)^(2*t),prod(1:2:2*t)*sigma^(2*t)); YXsub(g,1)=subs(YXsub(g,1),V(r)^(2*t),prod(1:2:2*t)*sigma^(2*t)); end end end for g=1:N*M for t=1:4*K for r=1:length(U) YXsub(g,1)=subs(YXsub(g,1),U(r)^(2*t-1),0); YXsub(g,1)=subs(YXsub(g,1),V(r)^(2*t-1),0); end end end %% DPD coefficients mathimatical relationships dpd_coeff=YYsub\YXsub;