zoukankan      html  css  js  c++  java
  • 全数字FM接收机2---仿真

    在MATLAB下仿真程序

     1 %Simple PLL m-file demonstration
     2  
     3 %This m-file demonstrates a PLL which tracks and demodulates an FM carrier.
     4 clear all; 
     5 close all; 
     6 f=1000;%Carrier frequency 
     7 fs=100000;%Sample frequency
     8 N=5000;%Number of samples
     9 Ts=1/fs;
    10 t=(0:Ts:(N*Ts)- Ts);
    11 %Create the message signal
    12 f1=100;%Modulating frequency
    13 msg=sin(2*pi*f1*t);
    14 kf=.0628;%Modulation index
    15 %Create the real and imaginary parts of a CW modulated carrier to be tracked.
    16 Signal=exp(j*(2*pi*f*t+2*pi*kf*cumsum(msg)));%Modulated carrier
    17 Signal1=exp(j*(2*pi*f*t));%Unmodulated carrier
    18 %Initilize PLL Loop 
    19 phi_hat(1)=30; 
    20 e(1)=0; 
    21 phd_output(1)=0; 
    22 vco(1)=0; 
    23 %Define Loop Filter parameters(Sets damping)
    24 kp=0.15; %Proportional constant 
    25 ki=0.1; %Integrator constant 
    26 %PLL implementation 
    27 for n=2:length(Signal) 
    28 vco(n)=conj(exp(j*(2*pi*n*f/fs+phi_hat(n-1))));%Compute VCO 
    29 phd_output(n)=imag(Signal(n)*vco(n));%Complex multiply VCO x Signal input 
    30 e(n)=e(n-1)+(kp+ki)*phd_output(n)-ki*phd_output(n-1);%Filter integrator 
    31 phi_hat(n)=phi_hat(n-1)+e(n);%Update VCO 
    32 end; 
    33 %Plot waveforms 
    34 startplot = 1;
    35 endplot = 1000;
    36 
    37 figure(1);
    38 subplot(3,2,1);
    39 plot(t(startplot:endplot), msg(startplot:endplot));
    40 title('100 Hz message signal');
    41 %xlabel('Time (seconds)');
    42 ylabel('Amplitude');
    43 grid;
    44 
    45 figure(1);
    46 subplot(3,2,2);
    47 plot(t(startplot:endplot), real(Signal(startplot:endplot)));
    48 title('FM (1KHz carrier modulated with a 100 Hz message signal)');
    49 %xlabel('Time (seconds)');
    50 ylabel('Amplitude');
    51 grid;
    52 
    53 figure(1)
    54 subplot(3,2,3);
    55 plot(t(startplot:endplot), e(startplot:endplot));
    56 title('PLL Loop Filter/Integrator Output');
    57 %xlabel('Time (seconds)');
    58 ylabel('Amplitude');
    59 grid;
    60 
    61 subplot(3,2,4);
    62 plot(t(startplot:endplot), real(vco(startplot:endplot)));
    63 title('VCO Output (PLL tracking the input signal)');
    64 %xlabel('Time (seconds)');
    65 ylabel('Amplitude');
    66 grid;
    67 
    68 subplot(3,2,5);
    69 plot(t(startplot:endplot), phd_output(startplot:endplot));
    70 title('Phase Detecter Output');
    71 xlabel('Time (seconds)');
    72 ylabel('Amplitude');
    73 grid;
    74 
    75 subplot(3,2,6);
    76 plot(t(startplot:endplot), real(Signal1(startplot:endplot)));
    77 title('Unmodulated Carrier');
    78 xlabel('Time (seconds)');
    79 ylabel('Amplitude');
    80 grid;
    View Code

    仿真结果

    image

    OPTIMISM, PASSION & HARDWORK
  • 相关阅读:
    数据中台实战(六):交易分析
    数据中台实战(五):自助分析平台(产品设计篇)
    数据中台实战(四):商品分析(产品设计篇)
    数据中台实战(三):用户分析(产品设计篇)
    数据中台实战(二):基于阿里OneData的数据指标管理体系
    数据中台实战(一):以B2B电商亿订为例,谈谈产品经理视角下的数据埋点
    LeetCode82. 删除排序链表中的重复元素 II
    LeetCode203. 移除链表元素
    LeetCode445. 两数相加 II
    LeetCode2. 两数相加
  • 原文地址:https://www.cnblogs.com/hiramlee0534/p/3442516.html
Copyright © 2011-2022 走看看