📄 blind3sub.m
字号:
% subspace method for blind channel estimation%%echoF=1; % turn on/off output displaydB=15;T=1000; % sample amountL=4; M=4; N=5; % L: antenna #. M: channel length. N: smoothing. d=M+N; % d: equalization delayj=sqrt(-1); mh=[-0.049+j*0.359 0.482-j*0.569 -0.556+j*0.587 1 -0.171+j*0.061; % channel 0.443-j*0.0364 1 0.921-j*0.194 0.189-j*0.208 -0.087-j*0.054; -0.221-j*0.322 -0.199+j*0.918 1 -0.284-j*0.524 0.136-j*0.19; 0.417+j*0.030 1 0.873+j*0.145 0.285+j*0.309 -0.049+j*0.161];h=[mh(1,:) mh(2,:) mh(3,:) mh(4,:)].';s=sign(rand(1,T)-0.5); s=s+sqrt(-1)*(sign(rand(1,T)-0.5)); %transmitted signals;TN=T-N+1; X=zeros(L*N,TN); SNR=[]; %received signalsfor i=1:L x=filter(h((i-1)*(M+1)+1:i*(M+1)),1,s); n=randn(size(x))+sqrt(-1)*randn(size(x)); n=n/norm(n)*10^(-dB/20)*norm(x); x=x+n; for j=1:TN, X((i-1)*N+1:i*N, j)=x(j+N-1:-1:j).'; endend %%%%%%%%%%%%%% subspace method Rx=X*X'/TN; % calculate correlation matrix[U0,S0,V0]=svd(Rx); % SVD to find null subspaceQ=zeros(L*(M+1), L*(M+1)); % Construct matrix Qfor i=d+1:L*N, Vm=zeros(L*(M+1), M+N); for j=1:(M+1), for k=1:L, Vm((k-1)*(M+1)+j, j:(j+N-1))=U0((k-1)*N+1:k*N, i).'; end end Q=Q+Vm*Vm';end[U1,S1,V1]=svd(Q); % solve equation Ah=0 by SVDhb=U1(:,L*(M+1)); % channel estimation%%%%%%% Compare channel estimation MSEhb_h=mean(hb./h); hb_hhb1=hb/hb_h;squ_err_h=sqrt((h-hb1)'*(h-hb1))/sqrt(h'*h)if echoF, % plot channels subplot(211), te=length(h); plot(1:te,real(hb1),'bo-',1:te,real(h),'r+'), grid legend('Estimated','Accurate') title('Real part of Channel'); subplot(212), plot(1:te,imag(hb1),'bo-',1:te,imag(h),'r+'); grid, legend('Estimated','Accurate') title('Imag Part of Channel')end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -