波束成型仿真源码程序

clc
clear all
close all
L=10000;
l=1:L 
T=1/(10^6);
% fs=10*5*10^6; %10fc
ts=T/L;   
% t=L*ts;
s(1,:)=[1 1 1 1 1 1 1 1];
s(2,:)=[1 1 1 1 -1 -1 -1 -1]; 
s(3,:)=[1 1 -1 -1 -1 -1 1 1];
 M=3;
  for m=1:M
      s(m,1:length(l))=(1/sqrt(T))*exp(i*2*pi*m*l*ts/T);   %transmitted signal
  end 
 R=0;
  for l=1:L
      R=R+s(:,l)*conj(s(:,l)');
  end
  R=(1/L)*R;
% R1(:,:)=sum(R); 
       
 theta1=40;    
   
 for i1=1:M
        if i1==1  
            at(i1)=1;
            bt(i1)=1; 
        else
            at(i1)=exp(-1i*pi*(i1-1)*sind(theta1));
            bt(i1)=exp(-1i*pi*(i1-1)*sind(theta1));
        end
 end
     At=at'*conj(bt);
     alpha=complex(rand(1),rand(1));
     At=At*alpha;
     
      for l=1:L           
          r(:,l)=At*s(:,l)+complex(randn(M,1),randn(M,1));
      end 
      E=0;
      %matched filter output
      for l=1:L
      E=E+r(:,l)*conj(s(:,l)');
      end
  
      
  E=(1/sqrt(L))*E;
      [U S V]=svd(R); 
      dt=At*U*(S^0.5);
      dt1=sqrt(L)*dt(:);
      g=M*M;
      mui=alpha*dt1+complex(randn(g,1),randn(g,1));
       theta=-40;
       for k=1:81
       gain(k)=20*log10(0.1)+20*log10(abs(1+exp(1i*pi*sind(theta))+exp(1i*2*pi*sind(theta))+exp(1i*3*pi*sind(theta))+exp(1i*4*pi*sind(theta))+exp(1i*5*pi*sind(theta))+exp(1i*6*pi*sind(theta))+exp(1i*7*pi*sind(theta))+exp(1i*8*pi*sind(theta))+exp(1i*9*pi*sind(theta))));
        gain1(k)=40*log10(0.1)+40*log10(abs(1+exp(1i*pi*sind(theta))+exp(1i*2*pi*sind(theta))+exp(1i*3*pi*sind(theta))+exp(1i*4*pi*sind(theta))+exp(1i*5*pi*sind(theta))+exp(1i*6*pi*sind(theta))+exp(1i*7*pi*sind(theta))+exp(1i*8*pi*sind(theta))+exp(1i*9*pi*sind(theta))));
        theta=theta+1;
       end
     plot(-40:1:40,gain,'--r')
     hold on
     plot(-40:1:40,gain1)
     axis([-40 40 -60 10]);
     legend('coherent tx signal','orthogonal signals')
     xlabel('theta[deg]');
     ylabel('G(theta)[dB]');
     title('Beam pattern for orthogonal and coherent signals')
     grid on
     

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

fpga和matlab

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值