Matlab实现数字编码的呈现

数字编码

补充说明:此代码建立在一定的信号与系统基础上

本代码的核心的代码为:stepfun(t, i) 阶跃函数
args:
    t: 信号的范围
    i: 阶跃点

例:stepfun((0: 0.05: 20), 3)

在这里插入图片描述

  • 二元码

    • 简单二元码

      • 单极性非归零
      function ut = s_1(n,i)
      t = -5:0.01:20;
          if n == 1
              ut = stepfun(t,i-1)-stepfun(t,i);
          else
              ut = stepfun(t,i-1)-stepfun(t,i-1);
          end 
      end
      
      • 单极性归零
      function ut = s_0(n,i)
          t = -5:0.01:20;
          if n == 1
              ut = stepfun(t,i-1)-stepfun(t,i-0.8);
          else
              ut = stepfun(t,i-1)-stepfun(t,i-1);
          end
      end
      
      • 双极性非归零
      function ut = d_1(n,i)
         t = -5:0.01:20;
         if n == 1
             ut = stepfun(t,i-1)-stepfun(t,i);
         else
             ut = -(stepfun(t,i-1)-stepfun(t,i));
         end
      end
      
      • 双极性归零
      function ut = d_0(n,i)
         t = -5:0.01:20;
         if n == 1
             ut = stepfun(t,i-1)-stepfun(t,i-0.8);
         else
             ut = -(stepfun(t,i-1)-stepfun(t,i-0.8));
         end
      end
      
      • 传号差分码
      function [ut,state] = c_c(n,i,form_state)
         t = -5:0.01:20;
         if i == 1
             if n == 1
                 ut = stepfun(t,i-1)-stepfun(t,i);
                 state = 1;
             else
                 ut = stepfun(t,i-1)-stepfun(t,i-1);
                 state = 0;
             end
         else
             if n == 1
                 if form_state == 1
                     ut = stepfun(t,i-1)-stepfun(t,i-1);
                     state = 0;
                 else
              
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值