SlideShare uma empresa Scribd logo
1 de 5
Matlab code for ofdm channel
estimation(pn sequence as cyclic
prefix)
blocks = 200;
%OFDM¿éÊý
%ÓëchanestnewÏà±È£¬Êǽ«ÏßÐÔÏà¹Ø¸ÄΪԲÖÜÏà¹Ø
%Êá×´µ¼ÆµÓë±¾ÎÄ·½·¨£¨µü´úÇ°ºÍµü´úºó£©×÷±È½Ï
% |--cp--|----PN----|------OFDM------|
tic;
fc = 2000;
%MHz,ϵͳÔز¨ÆµÂÊ
N = 512;
%×ÓÔز¨Êý
L = 32;
%Ñ-»·Ç°×º³¤¶È
Nf3 = 6;
%µ¼ÆµÂÊΪ
M = 26;
%¶à¾¶Êý%%%%%%%%%%%%%%
%generate transmitted signal
DN = blocks*N;
for j = 1:DN
temp = rand;
if (temp<0.25)
s(j) = 1;
elseif (temp<0.5)
s(j) = sqrt(-1);
elseif (temp<0.75)
s(j) = -1;
else
s(j) = (-1)*sqrt(-1);
end
end
%generate pn code
pns
pn = genpncode(6);
pL = length(pn)+L;
pns = [pn pn(1:L)];
PNS = fft(pns,N)/sqrt(N);

1*pL

s

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%transmit & receive
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for n = 1:blocks
for k = 1:N
TR(n,k) = s(N*(n-1)+k);
%convert series to parallel
end
end
for n = 1:blocks
tr1(n,:) = [pns ifft(TR(n,pL+1:N))*sqrt(N-pL)];
end
tr1 = [tr1(:,(N-L+1):N) tr1];
%blocks*(N+L)
for j = 1:blocks
ss1((j-1)*(N-pL)+1:j*(N-pL)) = s((j-1)*N+pL+1:j*N);
%±¾ÎÄËùÌá·½·¨µÄ´«ÊäÐźÅ
end
pfc = sqrt(-1)*ones(blocks,1);
TR3 = TR;
for j = 1:Nf3:N-2%%%%%%%%%%%%%

%ƵÓòÊá×´µ¼Æµ·½·¨3·¢ÉäµÄÊý¾Ý
TR3(:,j) = pfc;
end
TR3(:,end) = pfc;%%%%%%%%%%%%%%%%%%%%%%%%%%
for n = 1:blocks
tr3(n,:) = sqrt(N)*ifft(TR3(n,:))
end
tr3 = [tr3(:,(N-L+1):N) tr3];
%blocks*(N+L)
j = 1;
Npc = round(N/Nf3)+1;
%Êá×´µ¼ÆµÊý Npc = (N-1)/Nf3+1;%%%%%%%%%%%%%%
%for k = 1:N
%if (mod(k-1,Nf3)~=0)
%ss3(j:(Npc-1)*(Nf3-1):j+(blocks-1)*(Npc-1)*(Nf3-1)) = TR3(:,k);
%µÃµ½³ýµ¼ÆµÐźÅÍâµÄÊý¾ÝÐźÅ
%j = j+1;
%end
%end
for k = 1:N-1%
if (mod(k-1,Nf3)~=0)%
ss3(j:(Npc-1)*(Nf3-1)+1:j+(blocks-1)*((Npc-1)*(Nf3-1)+1)) = TR3(:,k);
%%µÃµ½³ýµ¼ÆµÐźÅÍâµÄÊý¾ÝÐźÅ
j = j+1;%
end%
end%
ss3(j:(Npc-1)*(Nf3-1)+1:j+(blocks-1)*((Npc-1)*(Nf3-1)+1)) = TR3(:,N-1); %
%delayTime = [0 0.2 0.6 1.6 2.4 5.0]*10^(-6);%%%%%%%%%%%%%%%%%%%
%delayn = delayTime/chipT;%%%%%%%%%%%%%%%%%%%%%
%averPower = %%%%%%%%%%%%%%%%%%
%channel %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pnss = pns(L+1:pL);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
delayn = 0:25;%[0 1 2 3];%[0 1 3 8 12 25];
%averPower = [0.189 0.379 0.239 0.095 0.060 0.038];[0.575 0.362 0.057 0.006];
snrdB = 0:5:25;
for m = 1:length(snrdB)
%%%%%%%%%%%%%%%%%%%%%%%channel model
h = zeros(N,blocks);%
for k=1:M%
h(delayn(k)+1,:)=randn(1,blocks)+sqrt(-1)*randn(1,blocks);%
end%
for k = 1:M%
h(delayn(k)+1,:) =
h(delayn(k)+1,:)/norm(h(delayn(k)+1,:))*sqrt(blocks);%
%¹éÒ»»¯ÐŵÀ N*blocks
end%
%for k = 1:M
%h(delayn(k)+1,:) = sqrt(averPower(k))*h(delayn(k)+1,:);
%end
for n = 1:blocks
h(:,n) = h(:,n)/norm(h(:,n));%¹éÒ»»¯ÐŵÀ
end
HL = fft(h);
% N*blocks
H(:,:,m) = HL';
Hs = reshape(H(:,:,m),1,N*blocks);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h1 = zeros(blocks,N);
h2 = zeros(blocks,N);%²ÎÊý¼ì²âδ¸Ä½ø֮ǰ
for n = 1:blocks
r1(n,:) = zeros(1,N);
r3(n,:) = zeros(1,N);
for j = 1:M
r1(n,:) = r1(n,:)+h(j,n).*tr1(n,(L+1-(j-1):N+L-(j-1)));%
r3(n,:) = r3(n,:)+h(j,n).*tr3(n,(L+1-(j-1):N+L-(j-1)));%
end
r1(n,:) = AWGN(r1(n,:),snrdB(m));
r3(n,:) = AWGN(r3(n,:),snrdB(m));
R1(n,:) = fft(r1(n,:))/sqrt(N);
%blocks*N
%R12(n,:) = fft(r12(n,:))/sqrt(N);
R3(n,:) = fft(r3(n,:))/sqrt(N);
%blocks*N
Rprw = circlecorr(pnss,r1(n,L+1:pL));
%Ϊ±¾ÎÄ·½·¨1×÷×¼±¸
Rs = Rprw;
for j = 1:M;
Rpp = Rs(pL-L:-1:1);
[a(n,j,m),b(n,j,m)] = max(Rpp);
a(n,j,m) = a(n,j,m)/(pL-L);
pnsd = [pnss(pL-L-b(n,j,m)+2:pL-L) pnss(1:pL-L-b(n,j,m)+1)];
Rppd = circlecorr(pnss,pnsd);
Rs = Rs-a(n,j,m)*Rppd;
h1(n,b(n,j,m)) = a(n,j,m);
%±¾ÎÄËùÌá·½·¨½á¹û
end
H1(n,:) = fft(h1(n,:))/sqrt(N);
Rs2 = Rprw;
%Ϊδµü´ú·½·¨×÷×¼±¸
for j = 1:M;
Rpp2 = Rs2(pL-L:-1:1);
[c(n,j,m),d(n,j,m)] = max(Rpp2);
c(n,j,m) = c(n,j,m)/(pL-L);
Rs2(pL-L-d(n,j,m)+1) = 0;
h2(n,d(n,j,m)) = c(n,j,m);
%±¾ÎÄËùÌá·½·¨½á¹û
end
H2(n,:) = fft(h2(n,:))/sqrt(N);
end
k3 = 1;
for j = 1:N-2;%j = 1:N
if (mod(j-1,Nf3)==0)
H3(:,k3) = R3(:,j)./pfc;
%ƵÓòÊá×´µ¼Æµ¹À¼Æ3½á¹û
k3 = k3+1;
end
end
H3(:,k3) = R3(:,N)./pfc; %%%%%%%%%%%%%%%%%
[X3,Y3] = meshgrid([1:Nf3:N-2 N],1:blocks);%[X3,Y3] =
meshgrid(1:Nf3:N,1:blocks);%%%%%%%%%%%
[X,Y] = meshgrid(1:N,1:blocks);
HH1(:,:,m) = H1*sqrt(N);
%±¾ÎÄ·½·¨1 ²åÖµÍê±Ïblocks¡ÁN
HH2(:,:,m) = H2*sqrt(N);
HH3(:,:,m) = interp2(X3,Y3,H3,X,Y,'linear');
%ƵÓòÊá×´µ¼Æµ·½·¨4²åÖµÍê±Ï
%¾ùºâ£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
TRe1 = R1./HH1(:,:,m);
for n = 1:blocks
tre1(n,:) = ifft(TRe1(n,:)-PNS)*sqrt(N);
TRe1(n,:) = [zeros(1,pL) fft(tre1(n,pL+1:N))/sqrt(N-pL)];
TRes1(N*(n-1)+1:N*n) = TRe1(n,:);
%²¢´®×ª»»
end
for j = 1:blocks
TRess1((j-1)*(N-pL)+1:j*(N-pL)) = TRes1((j-1)*N+pL+1:j*N);
%±¾ÎÄËùÌá·½·¨¾ùºâºóµÄƵÓò´«ÊäÐźÅ
end
TRe2 = R1./HH2(:,:,m);
for n = 1:blocks
tre2(n,:) = ifft(TRe2(n,:)-PNS)*sqrt(N);
TRe2(n,:) = [zeros(1,pL) fft(tre2(n,pL+1:N))/sqrt(N-pL)];
TRes2(N*(n-1)+1:N*n) = TRe2(n,:);
%²¢´®×ª»»
end
for j = 1:blocks
TRess2((j-1)*(N-pL)+1:j*(N-pL)) = TRes2((j-1)*N+pL+1:j*N);
%µü´úÇ°±¾ÎÄËùÌá·½·¨¾ùºâºóµÄƵÓò´«ÊäÐźÅ
end
j = 1;
TRe3 = R3./HH3(:,:,m);
%for k = 1:N
%if (mod(k-1,Nf3)~=0)
%TRess3(j:(Npc-1)*(Nf3-1):j+(blocks-1)*(Npc-1)*(Nf3-1)) =
TRe3(:,k);
%
%j = j+1;
%end
%end
for k = 1:N-1
if (mod(k-1,Nf3)~=0)
TRess3(j:(Npc-1)*(Nf3-1)+1:j+(blocks-1)*((Npc-1)*(Nf3-1)+1)) =
TRe3(:,k);
%
j = j+1;
end
end
TRess3(j:(Npc-1)*(Nf3-1)+1:j+(blocks-1)*((Npc-1)*(Nf3-1)+1)) = TRe3(:,N1);
%½âµ÷²¢¼ÆËãÎó±ÈÌØÂÊÎó·ûºÅÂÊ
[ps1(m),pb1(m)] = demanderr(ss1,TRess1);
[ps3(m),pb3(m)] = demanderr(ss3,TRess3);
[ps2(m),pb2(m)] = demanderr(ss1,TRess2);%
HH1s = reshape(HH1(:,:,m),1,N*blocks);
HH2s = reshape(HH2(:,:,m),1,N*blocks);
HH3s = reshape(HH3(:,:,m),1,N*blocks);
cc1(:,:,m) = corrcoef(abs(HH1s),abs(Hs));
cc2(:,:,m) = corrcoef(abs(HH2s),abs(Hs));
cc3(:,:,m) = corrcoef(abs(HH3s),abs(Hs));
end
simulation_T=toc;
figure;
semilogy(snrdB,pb2,'b-*',snrdB,pb1,'b-d',snrdB,pb3,'b-+');
legend('ʱÓò¹À¼Æ·½·¨','ʱÓò¹À¼Æ·½·¨£¨¸Ä½øÐŵÀ²ÎÊý¼ì²â£©','ƵÓòÊá×´µ¼Æµ·½·¨');
xlabel('ÐÅÔë±È/dB');
ylabel('ÎóÂëÂÊ');
grid on;
axis([0,25,10^(-4),10^0]);
figure;%
plot(1:N,abs(H(1,:,4)),'b-',1:N,abs(HH2(1,:,4)),'b-',1:N,abs(HH1(1,:,4)),'b:',1:N,abs(HH3(1,:,4)),'b-.');%
legend('ÕæʵÐŵÀ','ʱÓò¹À¼Æ·½·¨','ʱÓò¹À¼Æ·½·¨£¨¸Ä½øÐŵÀ²ÎÊý¼ì²â£©','ƵÓòÊá×´
µ¼Æµ·½·¨');%
xlabel('×ÓÔز¨');%
ylabel('ÐŵÀ·ùƵÏìÓ¦');%
axis([1 N 0 2]);

Mais conteúdo relacionado

Mais procurados

Matlab source codes section | Download MATLAB source code freerce-codes
Matlab source codes section | Download MATLAB source code freerce-codesMatlab source codes section | Download MATLAB source code freerce-codes
Matlab source codes section | Download MATLAB source code freerce-codeshafsabanu
 
Introduction To Wireless Fading Channels
Introduction To Wireless Fading ChannelsIntroduction To Wireless Fading Channels
Introduction To Wireless Fading ChannelsNitin Jain
 
Tracking in receivers
Tracking in receiversTracking in receivers
Tracking in receiversJay Patel
 
Concept of Diversity & Fading (wireless communication)
Concept of Diversity & Fading (wireless communication)Concept of Diversity & Fading (wireless communication)
Concept of Diversity & Fading (wireless communication)Omkar Rane
 
Correlative level coding
Correlative level codingCorrelative level coding
Correlative level codingsrkrishna341
 
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time SignalsDSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time SignalsAmr E. Mohamed
 
Small Scale Multi path measurements
Small Scale Multi path measurements Small Scale Multi path measurements
Small Scale Multi path measurements Siva Ganesan
 
Introduction to Wireless Communication
Introduction to Wireless CommunicationIntroduction to Wireless Communication
Introduction to Wireless CommunicationDilum Bandara
 
Sampling Theorem, Quantization Noise and its types, PCM, Channel Capacity, Ny...
Sampling Theorem, Quantization Noise and its types, PCM, Channel Capacity, Ny...Sampling Theorem, Quantization Noise and its types, PCM, Channel Capacity, Ny...
Sampling Theorem, Quantization Noise and its types, PCM, Channel Capacity, Ny...Waqas Afzal
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and InterpolationFernando Ojeda
 
Interference and system capacity
Interference and system capacityInterference and system capacity
Interference and system capacityAJAL A J
 
DSP_FOEHU - Lec 13 - Digital Signal Processing Applications I
DSP_FOEHU - Lec 13 - Digital Signal Processing Applications IDSP_FOEHU - Lec 13 - Digital Signal Processing Applications I
DSP_FOEHU - Lec 13 - Digital Signal Processing Applications IAmr E. Mohamed
 

Mais procurados (20)

Matlab source codes section | Download MATLAB source code freerce-codes
Matlab source codes section | Download MATLAB source code freerce-codesMatlab source codes section | Download MATLAB source code freerce-codes
Matlab source codes section | Download MATLAB source code freerce-codes
 
Introduction To Wireless Fading Channels
Introduction To Wireless Fading ChannelsIntroduction To Wireless Fading Channels
Introduction To Wireless Fading Channels
 
Matlab code
Matlab codeMatlab code
Matlab code
 
Tracking in receivers
Tracking in receiversTracking in receivers
Tracking in receivers
 
Concept of Diversity & Fading (wireless communication)
Concept of Diversity & Fading (wireless communication)Concept of Diversity & Fading (wireless communication)
Concept of Diversity & Fading (wireless communication)
 
Mobile Radio Propagations
Mobile Radio PropagationsMobile Radio Propagations
Mobile Radio Propagations
 
MIMO in 15 minutes
MIMO in 15 minutesMIMO in 15 minutes
MIMO in 15 minutes
 
Correlative level coding
Correlative level codingCorrelative level coding
Correlative level coding
 
OFDM
OFDMOFDM
OFDM
 
Channel Estimation
Channel EstimationChannel Estimation
Channel Estimation
 
Ofdm
OfdmOfdm
Ofdm
 
Digital communication unit II
Digital communication unit IIDigital communication unit II
Digital communication unit II
 
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time SignalsDSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
 
Small Scale Multi path measurements
Small Scale Multi path measurements Small Scale Multi path measurements
Small Scale Multi path measurements
 
Introduction to Wireless Communication
Introduction to Wireless CommunicationIntroduction to Wireless Communication
Introduction to Wireless Communication
 
Sampling Theorem, Quantization Noise and its types, PCM, Channel Capacity, Ny...
Sampling Theorem, Quantization Noise and its types, PCM, Channel Capacity, Ny...Sampling Theorem, Quantization Noise and its types, PCM, Channel Capacity, Ny...
Sampling Theorem, Quantization Noise and its types, PCM, Channel Capacity, Ny...
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and Interpolation
 
Waveform Coding
Waveform CodingWaveform Coding
Waveform Coding
 
Interference and system capacity
Interference and system capacityInterference and system capacity
Interference and system capacity
 
DSP_FOEHU - Lec 13 - Digital Signal Processing Applications I
DSP_FOEHU - Lec 13 - Digital Signal Processing Applications IDSP_FOEHU - Lec 13 - Digital Signal Processing Applications I
DSP_FOEHU - Lec 13 - Digital Signal Processing Applications I
 

Destaque

Wireless Channel Modeling - MATLAB Simulation Approach
Wireless Channel Modeling - MATLAB Simulation ApproachWireless Channel Modeling - MATLAB Simulation Approach
Wireless Channel Modeling - MATLAB Simulation ApproachJayamohan Govindaraj
 
Implementation of Wireless Channel Model in MATLAB: Simplified
Implementation of Wireless Channel Model in MATLAB: SimplifiedImplementation of Wireless Channel Model in MATLAB: Simplified
Implementation of Wireless Channel Model in MATLAB: SimplifiedRosdiadee Nordin
 
Simulation of A Communications System Using Matlab
Simulation of A Communications System Using MatlabSimulation of A Communications System Using Matlab
Simulation of A Communications System Using MatlabPolytechnique Montreal
 
Simulating communication systems with MATLAB: An introduction
Simulating communication systems with MATLAB: An introductionSimulating communication systems with MATLAB: An introduction
Simulating communication systems with MATLAB: An introductionAniruddha Chandra
 
Multiuser MIMO-OFDM simulation framework in Matlab
Multiuser MIMO-OFDM simulation framework in MatlabMultiuser MIMO-OFDM simulation framework in Matlab
Multiuser MIMO-OFDM simulation framework in MatlabPavel Loskot
 
MATLAB and Simulink for Communications System Design (Design Conference 2013)
MATLAB and Simulink for Communications System Design (Design Conference 2013)MATLAB and Simulink for Communications System Design (Design Conference 2013)
MATLAB and Simulink for Communications System Design (Design Conference 2013)Analog Devices, Inc.
 
Etude et simulation d'un système MIMO OFDM
Etude et simulation d'un système MIMO OFDMEtude et simulation d'un système MIMO OFDM
Etude et simulation d'un système MIMO OFDMMohamed Nadjib Chaabi
 
Mimo ofdm wireless communications with matlab
Mimo ofdm wireless communications with matlabMimo ofdm wireless communications with matlab
Mimo ofdm wireless communications with matlabntnam113
 
Simulation of Wireless Communication Systems
Simulation of Wireless Communication SystemsSimulation of Wireless Communication Systems
Simulation of Wireless Communication SystemsBernd-Peter Paris
 
Ofdm sim-matlab-code-tutorial web for EE students
Ofdm sim-matlab-code-tutorial web for EE studentsOfdm sim-matlab-code-tutorial web for EE students
Ofdm sim-matlab-code-tutorial web for EE studentsMike Martin
 
MIMO-OFDM SYSTEM IN RAYLEIGH FADDING CHANNEL
MIMO-OFDM SYSTEM IN RAYLEIGH FADDING CHANNELMIMO-OFDM SYSTEM IN RAYLEIGH FADDING CHANNEL
MIMO-OFDM SYSTEM IN RAYLEIGH FADDING CHANNELIJEEE
 
Final presentation
Final presentationFinal presentation
Final presentationRohan Lad
 
DIY OFDM Session
DIY OFDM SessionDIY OFDM Session
DIY OFDM SessionNutaq
 
Combating fading channels (1) (3)
Combating fading channels (1) (3)Combating fading channels (1) (3)
Combating fading channels (1) (3)liril sharma
 
ESTIMATION OF CHANNEL IN OFDM WIRELESS CHANNEL USING LS AND MMSE TECHNIQUES
ESTIMATION OF CHANNEL IN OFDM WIRELESS CHANNEL USING LS AND MMSE TECHNIQUESESTIMATION OF CHANNEL IN OFDM WIRELESS CHANNEL USING LS AND MMSE TECHNIQUES
ESTIMATION OF CHANNEL IN OFDM WIRELESS CHANNEL USING LS AND MMSE TECHNIQUESIAEME Publication
 
Ofdm performance analysis
Ofdm performance analysisOfdm performance analysis
Ofdm performance analysisSaroj Dhakal
 
OFDM transmission step-by-step
OFDM transmission step-by-stepOFDM transmission step-by-step
OFDM transmission step-by-stepErwin Riederer
 
Design Ofdm System And Remove Nonlinear Distortion In OFDM Signal At Transmit...
Design Ofdm System And Remove Nonlinear Distortion In OFDM Signal At Transmit...Design Ofdm System And Remove Nonlinear Distortion In OFDM Signal At Transmit...
Design Ofdm System And Remove Nonlinear Distortion In OFDM Signal At Transmit...Rupesh Sharma
 
Mimo ofdm by abhishek pandey
Mimo ofdm by abhishek pandeyMimo ofdm by abhishek pandey
Mimo ofdm by abhishek pandeyabhi29513
 

Destaque (20)

Wireless Channel Modeling - MATLAB Simulation Approach
Wireless Channel Modeling - MATLAB Simulation ApproachWireless Channel Modeling - MATLAB Simulation Approach
Wireless Channel Modeling - MATLAB Simulation Approach
 
Implementation of Wireless Channel Model in MATLAB: Simplified
Implementation of Wireless Channel Model in MATLAB: SimplifiedImplementation of Wireless Channel Model in MATLAB: Simplified
Implementation of Wireless Channel Model in MATLAB: Simplified
 
Simulation of A Communications System Using Matlab
Simulation of A Communications System Using MatlabSimulation of A Communications System Using Matlab
Simulation of A Communications System Using Matlab
 
Simulating communication systems with MATLAB: An introduction
Simulating communication systems with MATLAB: An introductionSimulating communication systems with MATLAB: An introduction
Simulating communication systems with MATLAB: An introduction
 
Multiuser MIMO-OFDM simulation framework in Matlab
Multiuser MIMO-OFDM simulation framework in MatlabMultiuser MIMO-OFDM simulation framework in Matlab
Multiuser MIMO-OFDM simulation framework in Matlab
 
4g lte matlab
4g lte matlab4g lte matlab
4g lte matlab
 
MATLAB and Simulink for Communications System Design (Design Conference 2013)
MATLAB and Simulink for Communications System Design (Design Conference 2013)MATLAB and Simulink for Communications System Design (Design Conference 2013)
MATLAB and Simulink for Communications System Design (Design Conference 2013)
 
Etude et simulation d'un système MIMO OFDM
Etude et simulation d'un système MIMO OFDMEtude et simulation d'un système MIMO OFDM
Etude et simulation d'un système MIMO OFDM
 
Mimo ofdm wireless communications with matlab
Mimo ofdm wireless communications with matlabMimo ofdm wireless communications with matlab
Mimo ofdm wireless communications with matlab
 
Simulation of Wireless Communication Systems
Simulation of Wireless Communication SystemsSimulation of Wireless Communication Systems
Simulation of Wireless Communication Systems
 
Ofdm sim-matlab-code-tutorial web for EE students
Ofdm sim-matlab-code-tutorial web for EE studentsOfdm sim-matlab-code-tutorial web for EE students
Ofdm sim-matlab-code-tutorial web for EE students
 
MIMO-OFDM SYSTEM IN RAYLEIGH FADDING CHANNEL
MIMO-OFDM SYSTEM IN RAYLEIGH FADDING CHANNELMIMO-OFDM SYSTEM IN RAYLEIGH FADDING CHANNEL
MIMO-OFDM SYSTEM IN RAYLEIGH FADDING CHANNEL
 
Final presentation
Final presentationFinal presentation
Final presentation
 
DIY OFDM Session
DIY OFDM SessionDIY OFDM Session
DIY OFDM Session
 
Combating fading channels (1) (3)
Combating fading channels (1) (3)Combating fading channels (1) (3)
Combating fading channels (1) (3)
 
ESTIMATION OF CHANNEL IN OFDM WIRELESS CHANNEL USING LS AND MMSE TECHNIQUES
ESTIMATION OF CHANNEL IN OFDM WIRELESS CHANNEL USING LS AND MMSE TECHNIQUESESTIMATION OF CHANNEL IN OFDM WIRELESS CHANNEL USING LS AND MMSE TECHNIQUES
ESTIMATION OF CHANNEL IN OFDM WIRELESS CHANNEL USING LS AND MMSE TECHNIQUES
 
Ofdm performance analysis
Ofdm performance analysisOfdm performance analysis
Ofdm performance analysis
 
OFDM transmission step-by-step
OFDM transmission step-by-stepOFDM transmission step-by-step
OFDM transmission step-by-step
 
Design Ofdm System And Remove Nonlinear Distortion In OFDM Signal At Transmit...
Design Ofdm System And Remove Nonlinear Distortion In OFDM Signal At Transmit...Design Ofdm System And Remove Nonlinear Distortion In OFDM Signal At Transmit...
Design Ofdm System And Remove Nonlinear Distortion In OFDM Signal At Transmit...
 
Mimo ofdm by abhishek pandey
Mimo ofdm by abhishek pandeyMimo ofdm by abhishek pandey
Mimo ofdm by abhishek pandey
 

Semelhante a matlab code for channel estimation for ofdm

Matlab kod taslağı
Matlab kod taslağıMatlab kod taslağı
Matlab kod taslağıMerve Cvdr
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876NgGiaHi
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876NgGiaHi
 
MIMO OFDM with Least square method and minimum mean square estim.docx
MIMO OFDM with Least square method and minimum mean square estim.docxMIMO OFDM with Least square method and minimum mean square estim.docx
MIMO OFDM with Least square method and minimum mean square estim.docxARIV4
 
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfIncorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfaartechindia
 
Fourier series example
Fourier series exampleFourier series example
Fourier series exampleAbi finni
 
Main code for images
Main code for imagesMain code for images
Main code for imagesPunit Karnani
 
Implicit crank nicolson - du fort-frankel - ftcs
Implicit crank nicolson - du fort-frankel - ftcsImplicit crank nicolson - du fort-frankel - ftcs
Implicit crank nicolson - du fort-frankel - ftcsParhamsagharchi
 
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdfI need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdfeyewatchsystems
 
Lecture 1
Lecture 1Lecture 1
Lecture 1butest
 
The Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorThe Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorAbhranil Das
 
Drill bit optimization code
Drill bit optimization codeDrill bit optimization code
Drill bit optimization codeANKIT KUKREJA
 
QFSK: BER and SER Derivation and Simulation
QFSK: BER and SER Derivation and SimulationQFSK: BER and SER Derivation and Simulation
QFSK: BER and SER Derivation and SimulationTom Cruz
 
bask, bfsk, bpsk
bask, bfsk, bpskbask, bfsk, bpsk
bask, bfsk, bpskblzz2net
 
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdfConsider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdfmeerobertsonheyde608
 

Semelhante a matlab code for channel estimation for ofdm (20)

Matlab kod taslağı
Matlab kod taslağıMatlab kod taslağı
Matlab kod taslağı
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876
 
MIMO OFDM with Least square method and minimum mean square estim.docx
MIMO OFDM with Least square method and minimum mean square estim.docxMIMO OFDM with Least square method and minimum mean square estim.docx
MIMO OFDM with Least square method and minimum mean square estim.docx
 
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfIncorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
 
Fourier series example
Fourier series exampleFourier series example
Fourier series example
 
Main code
Main codeMain code
Main code
 
matlab codes.pdf
matlab codes.pdfmatlab codes.pdf
matlab codes.pdf
 
Main code for images
Main code for imagesMain code for images
Main code for images
 
Implicit crank nicolson - du fort-frankel - ftcs
Implicit crank nicolson - du fort-frankel - ftcsImplicit crank nicolson - du fort-frankel - ftcs
Implicit crank nicolson - du fort-frankel - ftcs
 
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdfI need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
 
Mnistauto 5
Mnistauto 5Mnistauto 5
Mnistauto 5
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
The Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorThe Moore-Spiegel Oscillator
The Moore-Spiegel Oscillator
 
Drill bit optimization code
Drill bit optimization codeDrill bit optimization code
Drill bit optimization code
 
QFSK: BER and SER Derivation and Simulation
QFSK: BER and SER Derivation and SimulationQFSK: BER and SER Derivation and Simulation
QFSK: BER and SER Derivation and Simulation
 
CODING
CODINGCODING
CODING
 
bask, bfsk, bpsk
bask, bfsk, bpskbask, bfsk, bpsk
bask, bfsk, bpsk
 
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdfConsider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
 
Recursion in C
Recursion in CRecursion in C
Recursion in C
 

Último

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 

Último (20)

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 

matlab code for channel estimation for ofdm

  • 1. Matlab code for ofdm channel estimation(pn sequence as cyclic prefix) blocks = 200; %OFDM¿éÊý %ÓëchanestnewÏà±È£¬Êǽ«ÏßÐÔÏà¹Ø¸ÄΪԲÖÜÏà¹Ø %Êá×´µ¼ÆµÓë±¾ÎÄ·½·¨£¨µü´úÇ°ºÍµü´úºó£©×÷±È½Ï % |--cp--|----PN----|------OFDM------| tic; fc = 2000; %MHz,ϵͳÔز¨ÆµÂÊ N = 512; %×ÓÔز¨Êý L = 32; %Ñ-»·Ç°×º³¤¶È Nf3 = 6; %µ¼ÆµÂÊΪ M = 26; %¶à¾¶Êý%%%%%%%%%%%%%% %generate transmitted signal DN = blocks*N; for j = 1:DN temp = rand; if (temp<0.25) s(j) = 1; elseif (temp<0.5) s(j) = sqrt(-1); elseif (temp<0.75) s(j) = -1; else s(j) = (-1)*sqrt(-1); end end %generate pn code pns pn = genpncode(6); pL = length(pn)+L; pns = [pn pn(1:L)]; PNS = fft(pns,N)/sqrt(N); 1*pL s %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %transmit & receive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for n = 1:blocks for k = 1:N TR(n,k) = s(N*(n-1)+k); %convert series to parallel end end for n = 1:blocks tr1(n,:) = [pns ifft(TR(n,pL+1:N))*sqrt(N-pL)]; end tr1 = [tr1(:,(N-L+1):N) tr1]; %blocks*(N+L) for j = 1:blocks ss1((j-1)*(N-pL)+1:j*(N-pL)) = s((j-1)*N+pL+1:j*N); %±¾ÎÄËùÌá·½·¨µÄ´«ÊäÐźŠend pfc = sqrt(-1)*ones(blocks,1); TR3 = TR; for j = 1:Nf3:N-2%%%%%%%%%%%%% %ƵÓòÊá×´µ¼Æµ·½·¨3·¢ÉäµÄÊý¾Ý
  • 2. TR3(:,j) = pfc; end TR3(:,end) = pfc;%%%%%%%%%%%%%%%%%%%%%%%%%% for n = 1:blocks tr3(n,:) = sqrt(N)*ifft(TR3(n,:)) end tr3 = [tr3(:,(N-L+1):N) tr3]; %blocks*(N+L) j = 1; Npc = round(N/Nf3)+1; %Êá×´µ¼ÆµÊý Npc = (N-1)/Nf3+1;%%%%%%%%%%%%%% %for k = 1:N %if (mod(k-1,Nf3)~=0) %ss3(j:(Npc-1)*(Nf3-1):j+(blocks-1)*(Npc-1)*(Nf3-1)) = TR3(:,k); %µÃµ½³ýµ¼ÆµÐźÅÍâµÄÊý¾ÝÐźŠ%j = j+1; %end %end for k = 1:N-1% if (mod(k-1,Nf3)~=0)% ss3(j:(Npc-1)*(Nf3-1)+1:j+(blocks-1)*((Npc-1)*(Nf3-1)+1)) = TR3(:,k); %%µÃµ½³ýµ¼ÆµÐźÅÍâµÄÊý¾ÝÐźŠj = j+1;% end% end% ss3(j:(Npc-1)*(Nf3-1)+1:j+(blocks-1)*((Npc-1)*(Nf3-1)+1)) = TR3(:,N-1); % %delayTime = [0 0.2 0.6 1.6 2.4 5.0]*10^(-6);%%%%%%%%%%%%%%%%%%% %delayn = delayTime/chipT;%%%%%%%%%%%%%%%%%%%%% %averPower = %%%%%%%%%%%%%%%%%% %channel %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pnss = pns(L+1:pL); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% delayn = 0:25;%[0 1 2 3];%[0 1 3 8 12 25]; %averPower = [0.189 0.379 0.239 0.095 0.060 0.038];[0.575 0.362 0.057 0.006]; snrdB = 0:5:25; for m = 1:length(snrdB) %%%%%%%%%%%%%%%%%%%%%%%channel model h = zeros(N,blocks);% for k=1:M% h(delayn(k)+1,:)=randn(1,blocks)+sqrt(-1)*randn(1,blocks);% end% for k = 1:M% h(delayn(k)+1,:) = h(delayn(k)+1,:)/norm(h(delayn(k)+1,:))*sqrt(blocks);% %¹éÒ»»¯ÐŵÀ N*blocks end% %for k = 1:M %h(delayn(k)+1,:) = sqrt(averPower(k))*h(delayn(k)+1,:); %end for n = 1:blocks h(:,n) = h(:,n)/norm(h(:,n));%¹éÒ»»¯ÐŵÀ end HL = fft(h); % N*blocks H(:,:,m) = HL'; Hs = reshape(H(:,:,m),1,N*blocks);
  • 3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% h1 = zeros(blocks,N); h2 = zeros(blocks,N);%²ÎÊý¼ì²âδ¸Ä½ø֮ǰ for n = 1:blocks r1(n,:) = zeros(1,N); r3(n,:) = zeros(1,N); for j = 1:M r1(n,:) = r1(n,:)+h(j,n).*tr1(n,(L+1-(j-1):N+L-(j-1)));% r3(n,:) = r3(n,:)+h(j,n).*tr3(n,(L+1-(j-1):N+L-(j-1)));% end r1(n,:) = AWGN(r1(n,:),snrdB(m)); r3(n,:) = AWGN(r3(n,:),snrdB(m)); R1(n,:) = fft(r1(n,:))/sqrt(N); %blocks*N %R12(n,:) = fft(r12(n,:))/sqrt(N); R3(n,:) = fft(r3(n,:))/sqrt(N); %blocks*N Rprw = circlecorr(pnss,r1(n,L+1:pL)); %Ϊ±¾ÎÄ·½·¨1×÷×¼±¸ Rs = Rprw; for j = 1:M; Rpp = Rs(pL-L:-1:1); [a(n,j,m),b(n,j,m)] = max(Rpp); a(n,j,m) = a(n,j,m)/(pL-L); pnsd = [pnss(pL-L-b(n,j,m)+2:pL-L) pnss(1:pL-L-b(n,j,m)+1)]; Rppd = circlecorr(pnss,pnsd); Rs = Rs-a(n,j,m)*Rppd; h1(n,b(n,j,m)) = a(n,j,m); %±¾ÎÄËùÌá·½·¨½á¹û end H1(n,:) = fft(h1(n,:))/sqrt(N); Rs2 = Rprw; %Ϊδµü´ú·½·¨×÷×¼±¸ for j = 1:M; Rpp2 = Rs2(pL-L:-1:1); [c(n,j,m),d(n,j,m)] = max(Rpp2); c(n,j,m) = c(n,j,m)/(pL-L); Rs2(pL-L-d(n,j,m)+1) = 0; h2(n,d(n,j,m)) = c(n,j,m); %±¾ÎÄËùÌá·½·¨½á¹û end H2(n,:) = fft(h2(n,:))/sqrt(N); end k3 = 1; for j = 1:N-2;%j = 1:N if (mod(j-1,Nf3)==0) H3(:,k3) = R3(:,j)./pfc; %ƵÓòÊá×´µ¼Æµ¹À¼Æ3½á¹û k3 = k3+1; end end H3(:,k3) = R3(:,N)./pfc; %%%%%%%%%%%%%%%%% [X3,Y3] = meshgrid([1:Nf3:N-2 N],1:blocks);%[X3,Y3] = meshgrid(1:Nf3:N,1:blocks);%%%%%%%%%%% [X,Y] = meshgrid(1:N,1:blocks); HH1(:,:,m) = H1*sqrt(N); %±¾ÎÄ·½·¨1 ²åÖµÍê±Ïblocks¡ÁN HH2(:,:,m) = H2*sqrt(N);
  • 4. HH3(:,:,m) = interp2(X3,Y3,H3,X,Y,'linear'); %ƵÓòÊá×´µ¼Æµ·½·¨4²åÖµÍê±Ï %¾ùºâ£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½ TRe1 = R1./HH1(:,:,m); for n = 1:blocks tre1(n,:) = ifft(TRe1(n,:)-PNS)*sqrt(N); TRe1(n,:) = [zeros(1,pL) fft(tre1(n,pL+1:N))/sqrt(N-pL)]; TRes1(N*(n-1)+1:N*n) = TRe1(n,:); %²¢´®×ª»» end for j = 1:blocks TRess1((j-1)*(N-pL)+1:j*(N-pL)) = TRes1((j-1)*N+pL+1:j*N); %±¾ÎÄËùÌá·½·¨¾ùºâºóµÄƵÓò´«ÊäÐźŠend TRe2 = R1./HH2(:,:,m); for n = 1:blocks tre2(n,:) = ifft(TRe2(n,:)-PNS)*sqrt(N); TRe2(n,:) = [zeros(1,pL) fft(tre2(n,pL+1:N))/sqrt(N-pL)]; TRes2(N*(n-1)+1:N*n) = TRe2(n,:); %²¢´®×ª»» end for j = 1:blocks TRess2((j-1)*(N-pL)+1:j*(N-pL)) = TRes2((j-1)*N+pL+1:j*N); %µü´úÇ°±¾ÎÄËùÌá·½·¨¾ùºâºóµÄƵÓò´«ÊäÐźŠend j = 1; TRe3 = R3./HH3(:,:,m); %for k = 1:N %if (mod(k-1,Nf3)~=0) %TRess3(j:(Npc-1)*(Nf3-1):j+(blocks-1)*(Npc-1)*(Nf3-1)) = TRe3(:,k); % %j = j+1; %end %end for k = 1:N-1 if (mod(k-1,Nf3)~=0) TRess3(j:(Npc-1)*(Nf3-1)+1:j+(blocks-1)*((Npc-1)*(Nf3-1)+1)) = TRe3(:,k); % j = j+1; end end TRess3(j:(Npc-1)*(Nf3-1)+1:j+(blocks-1)*((Npc-1)*(Nf3-1)+1)) = TRe3(:,N1); %½âµ÷²¢¼ÆËãÎó±ÈÌØÂÊÎó·ûºÅÂÊ [ps1(m),pb1(m)] = demanderr(ss1,TRess1); [ps3(m),pb3(m)] = demanderr(ss3,TRess3); [ps2(m),pb2(m)] = demanderr(ss1,TRess2);% HH1s = reshape(HH1(:,:,m),1,N*blocks); HH2s = reshape(HH2(:,:,m),1,N*blocks); HH3s = reshape(HH3(:,:,m),1,N*blocks); cc1(:,:,m) = corrcoef(abs(HH1s),abs(Hs)); cc2(:,:,m) = corrcoef(abs(HH2s),abs(Hs)); cc3(:,:,m) = corrcoef(abs(HH3s),abs(Hs));