⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 part2b.m

📁 In this program, several statistical fading channel simulators using the Sum-of-Sinusoids (SoS)has b
💻 M
字号:
clc;
close all;
clear all;
echo off;

fd=100;
wd=2*pi*fd;
M=8;
N=4*M+2;
Ts=1e-2;
Ns=100;
i=5;
rand('state',sum(100*clock));
 s = rand('state');
 a= rand(1,M);
 thetan=a*(2*pi)-pi;
 b=rand(1,M);
 phin=b*(2*pi)-pi;
 

 t=(-1*i):Ts:i;
    suma=0;
    for n=1:M 
     alphan(n)=((2*pi*n)+thetan(n))/M; 
     suma=suma+exp(j*(wd*t*cos(alphan(n))+phin(n))); 
    end
    G=sqrt(1/M)*suma;
%  plot([-1*i:Ts:i],abs(G),'g');

[m,n]=hist(abs(G),100);
su=sum(m);
m=m/su/(n(2)-n(1));
figure;
% subplot(3,1,3),
plot(n,m);
title('PDF of G(t)-Rayleigh');
xlabel('Bin values');
ylabel('Normalised Probability');
 
Variance_G=var(abs(G))


 
 
 t=(-1*i):Ts:i;
    suma=0;
    sumb=0;
    for n=1:M 
        
        alphan(n)=((2*pi*n)+thetan(n))/M;        
        suma=suma+(cos((wd*t*cos(alphan(n)))+phin(n)));
        sumb=sumb+(sin((wd*t*cos(alphan(n)))+phin(n)));
    end
    Zc=sqrt(1/M)*suma;
    Zs=sqrt(1/M)*sumb;
    Z=Zc+(j*Zs);
    mean_Zc=mean(Zc)
    mean_Zs=mean(Zs)
    mean_Z=mean(abs(Z))
    Variance_Zc=var(Zc)
    Variance_Zs=var(Zs)
    Variance_Z=var(abs(Z))
    
    
%     plot([-1*i:Ts:i],Zc,'m');
%     figure;
%     plot([-1*i:Ts:i],Zs,'m');
%     figure;
%     plot([-1*i:Ts:i],abs(Z),'m');

[m,n]=hist(Zc,100);
su=sum(m);
m=m/su/(n(2)-n(1));
figure;
% subplot(3,1,1),
plot(n,m);
title('PDF of Zc(t)-Gaussian');
xlabel('Bins');
ylabel('Normalised Probability');
[m,n]=hist(Zs,100);
su=sum(m);
m=m/su/(n(2)-n(1));
figure;
% subplot(3,1,2),
plot(n,m);
title('PDF of Zs(t)-Gaussian');
xlabel('Bins');
ylabel('Normalised Probability');
[m,n]=hist(abs(Z),100);
su=sum(m);
m=m/su/(n(2)-n(1));
figure;
% subplot(3,1,3),
plot(n,m);
hold on;
title('PDF of Z(t)-Rayleigh');
xlabel('Bin values');
ylabel('Normalised Probability');
 

pdf_theory=n./(Variance_Z).*exp(-(n).^2/(2*Variance_Z));
plot(n,pdf_theory,'m');


G1=abs(G).^2;
[m,n]=hist(G1,150);
su=sum(m);
m=m/su/(n(2)-n(1));
figure;
% subplot(3,1,1),
plot(n,m,'m','LineWidth',3);
hold on;
title('pdf of |g(t)|^2 and |Z(t)|^2--"Exact overlapping" ');
xlabel('Bins');
ylabel('Normalised Probability');

Z1=abs(Z).^2;
[m,n]=hist(Z1,150);
su=sum(m);
m=m/su/(n(2)-n(1));
plot(n,m,'k','LineWidth',0.5);


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -