各位matlab大神给我解读一下这些程序,尽量具体点,谢啦!!!有奖励的
fc=2*10^9;v=110;c=300*10^6;fm=fc*(v*10^3/3600)/c;N=128;gap=2*fm/(N-1);T=1/gap;sf0=1.5...
fc=2*10^9;
v=110;
c=300*10^6;
fm=fc*(v*10^3/3600)/c;
N=128;
gap=2*fm/(N-1);
T=1/gap;
sf0=1.5/(pi*fm);
for n=(1:(N-2)/2)
sf(n) = 1.5/(pi*fm*sqrt(1-(n*gap/fm)^2));
end
SEf = [fliplr(sf),sf0,sf];
figure(1);
plot(SEf),title('多普勒功率谱'), xlabel('f'), ylabel('size'),
grid;
x1=randn(1,N);
x2=randn(1,N);
x=x1+1i*x2;
pha=2*pi*rand(1,N);
i= linspace(1,N,N);
sigma=sqrt(var(x)/2);
syms t;
tt=linspace(0,0.35,N);
ci=sigma*(2/N).^0.5;
fi=fm.*sin(pi/(2*N)*(i-1/2));
ph=2.*pi.*fi*t+pha;
Tc1=ci.*cos(ph);
Ts1=ci.*sin(ph);
Tc2=sum(Tc1);
Ts2=sum(Ts1);
Tc=subs(Tc2,t,tt);
Ts=subs(Ts2,t,tt);
st=Tc.*cos(2*pi.*tt)-Ts.*sin(2*pi.*tt);
rt = sqrt((real(Tc).^2 + real(Ts).^2));
% rt=sqrt(Tc.^2+Ts.^2)
rt_db=20*log10(rt);
st_db=20*log10(st);
figure(2);
plot(tt,rt_db),axis([0 20,0 100]) ,title('瑞利衰落信道'),xlabel('t'),ylabel('dB'),grid
figure(3)
n=0:0.1:10;
r=sqrt(sigma*(x1.^2+x2.^2));
h=hist(r,n);
fr_approx=h/(0.1*sum(h));
pijun=sum(r)/N;
junfanghe=(r-pijun).^2;
junfang=sum(junfanghe)/N;
u=0;
cdf=raylcdf(n,sigma);
subplot(3,1,1);
plot(n,cdf),title('CDF');
pdf=raylpdf(n,sigma);
subplot(3,1,2);
plot(n,pdf),title('PDF');
hold on;
plot(n,fr_approx,'ko');
axis([0 8,0 1]) ;
wucha=fr_approx-pdf; subplot(3,1,3);
plot(n,wucha),title('误差');
R=raylrnd(sigma,1,1000);
E=mean(R);
D=cov(R);
figure(4)
plot(Tc,'.'),title('时域高斯信号(Tc)'),xlabel('N'),ylabel('正交信号'), grid;
%时域高斯信号Ts
figure(5)
plot(Ts,'.'),title('时域高斯信号(Ts)'), xlabel('N'), ylabel('正交信号'),grid;
我希望各位大神能给我解释一下,每行程序代码是什么意思?qq:929804034 展开
v=110;
c=300*10^6;
fm=fc*(v*10^3/3600)/c;
N=128;
gap=2*fm/(N-1);
T=1/gap;
sf0=1.5/(pi*fm);
for n=(1:(N-2)/2)
sf(n) = 1.5/(pi*fm*sqrt(1-(n*gap/fm)^2));
end
SEf = [fliplr(sf),sf0,sf];
figure(1);
plot(SEf),title('多普勒功率谱'), xlabel('f'), ylabel('size'),
grid;
x1=randn(1,N);
x2=randn(1,N);
x=x1+1i*x2;
pha=2*pi*rand(1,N);
i= linspace(1,N,N);
sigma=sqrt(var(x)/2);
syms t;
tt=linspace(0,0.35,N);
ci=sigma*(2/N).^0.5;
fi=fm.*sin(pi/(2*N)*(i-1/2));
ph=2.*pi.*fi*t+pha;
Tc1=ci.*cos(ph);
Ts1=ci.*sin(ph);
Tc2=sum(Tc1);
Ts2=sum(Ts1);
Tc=subs(Tc2,t,tt);
Ts=subs(Ts2,t,tt);
st=Tc.*cos(2*pi.*tt)-Ts.*sin(2*pi.*tt);
rt = sqrt((real(Tc).^2 + real(Ts).^2));
% rt=sqrt(Tc.^2+Ts.^2)
rt_db=20*log10(rt);
st_db=20*log10(st);
figure(2);
plot(tt,rt_db),axis([0 20,0 100]) ,title('瑞利衰落信道'),xlabel('t'),ylabel('dB'),grid
figure(3)
n=0:0.1:10;
r=sqrt(sigma*(x1.^2+x2.^2));
h=hist(r,n);
fr_approx=h/(0.1*sum(h));
pijun=sum(r)/N;
junfanghe=(r-pijun).^2;
junfang=sum(junfanghe)/N;
u=0;
cdf=raylcdf(n,sigma);
subplot(3,1,1);
plot(n,cdf),title('CDF');
pdf=raylpdf(n,sigma);
subplot(3,1,2);
plot(n,pdf),title('PDF');
hold on;
plot(n,fr_approx,'ko');
axis([0 8,0 1]) ;
wucha=fr_approx-pdf; subplot(3,1,3);
plot(n,wucha),title('误差');
R=raylrnd(sigma,1,1000);
E=mean(R);
D=cov(R);
figure(4)
plot(Tc,'.'),title('时域高斯信号(Tc)'),xlabel('N'),ylabel('正交信号'), grid;
%时域高斯信号Ts
figure(5)
plot(Ts,'.'),title('时域高斯信号(Ts)'), xlabel('N'), ylabel('正交信号'),grid;
我希望各位大神能给我解释一下,每行程序代码是什么意思?qq:929804034 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询