返回信息流这是UMTS的几个传输模型代码,有错出不了图啊,研究了半天不知道是哪里的问题,显示一个函数出错,觉得没有错呀,麻烦大家帮忙看下了!谢谢!!
close all;
clear all;
clc;
CCout=3; %output in vitebi decoding
Sh_reg=8; %memory length of Viterbi Decoder.
BW=3.84e6; % Digital bandwidth
SF_Bit=6;
SaFa=2^SF_Bit; %Spread factor
SF_DB=10*log10(SaFa);
WindowL=15; %Window length for searching
P= 3; % Gold buffer
T_c=1/BW; %Chip duration
Data_Rate=1/(SaFa*T_c); %bits/s
Chi_Num=2; % channel number I and Q
Chq_Num=2;
Ch_Num=4; %Channel Number for I&Q except Pilot channel
Iperm=randperm(SaFa-1)+1; % Permatation
INDX=Iperm(1:Ch_Num)';
FL=1/(100*SaFa*P*T_c)-Sh_reg; %Signal length without tail bits.
Intlv_Len=1/(100*SaFa*T_c);
Intlv_Idx=[96 100;64 75;48 50;30 40;24 25;15 20;10 15]; %SaFa between 2 and 8
Intlv_Vec=reshape(1:Intlv_Len,Intlv_Idx(SF_Bit-1,1),Intlv_Idx(SF_Bit-1,2))'; % make interleaver index.
Intlv_Vec=Intlv_Vec(:);
W_matrix=ones(length(INDX),1);
for k=1:SF_Bit
W_matrix=[W_matrix W_matrix.*((1-2*bitget(INDX,k))*ones(1,size(W_matrix,2)))];
end
int=[ ones(1,25) -1]; %For Gold sequence
int1=[-ones(1,25) -1];
sigoutput=zeros(1,600); %Buffer for source signal
Tx=zeros(2*FL,Ch_Num);
G_Buffer=zeros(1,WindowL-P+1); % Gold buffer intiallizer
kk=0;
pp=0;
sig_spread=0;
for k=1:1:600
kk=kk+1;
Gold=(int(1)*int1(1)+j*prod(int([5 8 19]))*prod(int1([5 7 17])));%Gold sequence
int=[int(2:end) int(1)*int(4)]; %Shift register
int1=[int1(2:end) prod(int1(1:4))];
G_Buffer=[Gold G_Buffer(1:end-1)]; % final value on buffer
flag=mod(kk-1,SaFa*CCout*(FL+Sh_reg))+1;
Tx_Tmp=rand(Tx_Tmp,Ch_Num); %Encode for every coder channel.
Rnd_Sour=cnv_enc(Tx_Tmp, Sh_reg, CCout)'; %convolotional encoder with 1/3 rate.
Rnd_Sour=Rnd_Sour(:,Intlv_Vec); %Intleaver
Tx=[Tx(FL+1:end,:);Tx_Tmp];
sig_spread=Rnd_Sour(:,ceil(flag/SaFa)).*W_matrix(:,mod(kk-1,SaFa)+1); %Walsh spreading
sig_spread=((sum(sig_spread(1:Chi_Num))+j*(sum(sig_spread(Chi_Num+1:end))+1))*Gold);% complex data I+j*Q
sigoutput=[sig_spread sigoutput(1:end-1)]; % output of UMTS transmitter....
end
frequency=input('Enter the frequency for model= ');
Lamda=(3*10^8)/(frequency*10^6);
hre=3;
hte=200;
Gb=3.98;
Gm=1;
distance=1:.02:5;
if((frequency>=150)&&(frequency<=1500))
for k = 1 : length(distance),
hata1(k) = 0;
p = 69.55 + 26.16*log10(frequency) - 13.82*log10(hte) + (44.9 - 6.55*log10(hte))*log10(distance(k));
a = 0;
a = (1.1*log10(frequency) - 0.7)*hre - (1.56*log10(frequency) - 0.8);
p = p - a;
LU(k) = p;
%Signal power reduced due to current loss
%Current signal is (after suffering the power loss)
outputsig_Loss = sigoutput*sqrt(10^(-LU(k)/10));
a11(k)=mean(abs(outputsig_Loss));
outputsig_LossDB(k)=10*log10(a11(k));
end
plot(distance, outputsig_LossDB,'m.'); hold on;
xlabel('Distance');
ylabel('Path Loss [dB]');
title(['Propagation Pathloss in UMTS']);
elseif((frequency>=1500)&&(frequency<=2000))
s=0;
for k = 1 : length(distance),
L = 46.30 + 33.90*log10(frequency) - 13.82*log10(hte) + (44.9 - 6.55*log10(hte))*log10(distance(k));
L = L -(1.1*log10(frequency)-0.7)*hre + (1.56*log10(frequency)-0.8);
LU(k) = L;
%Signal power reduced due to current loss
%Current signal is (after suffering the power loss)
outputsig_Loss = sigoutput*sqrt(10^(-LU(k)/10));
a11(k)=mean(abs(outputsig_Loss));
outputsig_LossDB(k)=10*log10(a11(k));
end
plot(distance, outputsig_LossDB,'m.'); hold on;
xlabel('Distance');
ylabel('Path Loss [dB]');
title(['Propagation Pathloss in UMTS']);
else
disp('ERROR: Frequency range should be from 150MHZ to 2000MHZ');
return;
end
%%%%%%%%%%%%%%%%%COST321WI%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
distance1=.02:.02:5;
b=50;
w=b/2;
roof=3; %for pitched
hroof=3+roof;
ph=90;
ka = 0;
kd = 0;
kf = 0;
Lbsk = 0;
dhre = hroof - hre;
dhte = hte - hroof;
p = 0;
lori = 0;
if ph < 35
lori = -10+0.354*ph;
elseif ph >= 35 & ph < 55
lori = 2.5+0.075*(ph-35);
else
lori = 4.0-0.114*(ph-55);
end
p = -16.9 -10*log10(w) + 10*log10(frequency) + 20*log10(dhre) + lori;
if p < 0
p = 0;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
p1 = 0;
s = 0;
if hte > hroof
Lbsk = -18*log10(1 + dhte);
elseif hte < hroof
Lbsk=0;
end
kf = -4 + 1.5 * (frequency / 925 - 1);
if hte > hroof
kd = 18;
else
kd = 18 - 15 * (hte - hroof) / hroof;
end
for n = 1 : length(distance1),
if hte > hroof
ka = 54;
elseif hte <= hroof
if diatnce1(n) >= 0.5
ka = 54 - 0.8 * dhte;
else
ka = 54 - 1.6 * dhte * distance1(n);
end
end
p1 = Lbsk + ka + kd*log10(distance1(n)) + kf*log10(frequency) - 9*log10(b);
if p1 < 0
p1 = 0;
end
s(n) = p1;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
for k = 1 : length(distance1),
LU2(k) = s(k) + p + 20*log10(distance1(k))+20*log10(frequency)+32.44;
%Signal power reduced due to current loss
%Current signal is (after suffering the power loss)
outputsig_Loss2 = sigoutput*sqrt(10^(-LU2(k)/10));
a13(k)=mean(abs(outputsig_Loss2));
outputsig_LossDB2(k)=10*log10(a13(k));
end
plot(distance1, outputsig_LossDB2,'*b'); hold on;
xlabel('Distance');
ylabel('Path Loss [dB]');
title(['Propagation Pathloss in UMTS']);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%BERTONI MODEL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
hb=200;
hre=3;
w= 73.8;
ho=30.63;
h=hb-ho;
Lo=0;
Lex=0;
A=0;
distance2=.02:.02:5;
% City Size: Small/Medium
% Area Type : Suburban
for k = 1 : length(distance2),
fa=(distance2(k)^2)/(17*h);
A=5*log10((w/2)^2+(ho-hre)^2)-9*log10(w)+20*log10(atan(2*(ho-hre)/w));
Lex(k)=57.1+A+log10(frequency)+18*log10(distance2(k))-18*log10(h)-18*log10(1-fa);
Lo(k)=Lex(k)+20*log10(distance2(k))+20*log10(frequency)+32.44;
outputsig_Loss3 = sigoutput*sqrt(10^(-Lo(k)/10));
a14(k)=mean(abs(outputsig_Loss3));
outputsig_LossDB3(k)=10*log10(a14(k));
end
plot(distance2, outputsig_LossDB3,'+r'); %hold on;
xlabel('Distance Km');
ylabel('Path Loss [dB]');
title(['Propagation Pathloss in UMTS']);
legend('Okumara-Hata','COST321-IK','Bertoni',1);
axis([-0.05 5 -70 -20]);
这是一条镜像帖。来源:北邮人论坛 / matlab / #6932同步于 2010/5/4
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Matlab机器人发帖
【紧急求助】各位大虾麻烦帮忙看下代码哪里有问题
yinglinda
2010/5/4镜像同步0 回复
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。