【 MATLAB 】常用的离散时间序列的 Matlab 产生

举报
李锐博恩 发表于 2021/07/15 05:26:13 2021/07/15
【摘要】 单位样本序列   clcclearclose alln1 = 0;n2 = 5;n0 = 3; n = [n1:n2];x = [(n - n0) == 0]; stem(n,x,'filled');ylim([-1,2]); 改成一个函数: function [x,n]=delta(n0,n1,n2);% generate x(n) = delta...

单位样本序列

 

delta (n-n_0)=left{begin{matrix} 1 & n=n_0\0 & nneq n_0 end{matrix}right.


      clc
      clear
      close all
      n1 = 0;
      n2 = 5;
      n0 = 3;
      n = [n1:n2];
      x = [(n - n0) == 0];
      stem(n,x,'filled');
      ylim([-1,2]);
  
 

改成一个函数:


      function [x,n]=delta(n0,n1,n2);
      % generate x(n) = delta(n - n0); n1 <= n <= n2
      %_____________________________________________
      %[x,n] = delta(n0, n1, n2);
      %
      n = [n1:n2];
      x = [(n-n0) == 0];
  
 

命名为delta.m

新建一个脚本:


      n0 = 3;
      n1 = -3;
      n2 = 6;
      [x,n] = delta(n0,n1,n2);
      stem(n,x,'filled');
      ylim([-1,2]);
  
 

运行得到:



单位阶跃序列

u(n-n_0)=left{begin{matrix} 1, &ngeq n_0 \0, & nleq n_0 end{matrix}right.

直接写成函数形式吧:


      function [x,n]=stepseq(n0,n1,n2);
      % generate x(n) = u(n - n0); n1 <= n <= n2
      %_____________________________________________
      %[x,n] = stepseq(n0, n1, n2);
      %
      n = [n1:n2];
      x = [(n-n0) >= 0];
  
 

新建一个脚本,测试:


      clc
      clear
      close all
      n0 = 3;
      n1 = -3;
      n2 = 6;
      [x,n] = stepseq(n0,n1,n2);
      stem(n,x,'filled');
      ylim([-1,2]);
  
 

结果:



实值指数序列

x(n) = a^n,forall n;ain R 为一般形式。

下面产生一个序列:

x(n) = 0.9^n,nin [0,10]

脚本代码:


      clc
      clear
      close all
      n = -3:10;
      x = 0.9.^n;
      stem(n,x,'filled');
      xlabel('n');
      ylabel('0.9^n');
      xlim([-5,13]);
      ylim([0,2]);
  
 



复指数序列

x(n) = e^{(sigma + jw_0)n},forall n


      clc
      clear
      close all
      n = 0:10;
      x = exp( (2+3j)*n );
      stem(n,x);
      xlabel('n');
  
 



周期序列


      clc
      clear
      close all
      n = 0:10;
      x = exp( (2+3j)*n );
      subplot(2,1,1)
      stem(n,x);
      xlabel('n');
      title('Not Period Sequence');
      % the number of period
      P = 5;
      xtilde = x' * ones(1,P);
      xtilde = xtilde(:)';
      subplot(2,1,2);
      stem(xtilde);
      title('Period Sequence');
  
 

文章来源: reborn.blog.csdn.net,作者:李锐博恩,版权归原作者所有,如需转载,请联系作者。

原文链接:reborn.blog.csdn.net/article/details/83242660

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。