上代码

% noise sequence 1
x = [3, 11, 7, 0, -1, 4, 2]; nx = [-3:3]; % given signal x(n)
[y,ny] = sigshift(x,nx,2); % obtain x(n-2) set(gcf,'Color','white')
subplot(2,1,1);stem(nx,x); title('sequence x(n)');
xlabel('n');ylabel('x(n)'); grid on
subplot(2,1,2);stem(ny,y);title('sequence x(n-2)')
xlabel('n');ylabel('x(n-2)'); grid on w = randn(1,length(y)); nw = ny; % generate w(n)
[y,ny] = sigadd(y,ny,w,nw); % obtain y(n)=x(n-2)+w(n)
[x,nx] = sigfold(x,nx); % obtain x(-n)
[rxy,nrxy] = conv_m(y,ny,x,nx); % crosscorrelation figure
set(gcf,'Color','white')
subplot(1,1,1), subplot(2,1,1); stem(nrxy,rxy);
axis([-5,10,-50,250]); xlabel('lag variable 1')
ylabel('rxy'); title('crosscorrelation: noise sequence 1')
grid on
%
% noise sequence 2
x = [3, 11, 7, 0, -1, 4, 2]; nx = [-3:3]; % given signal x(n)
[y,ny] = sigshift(x,nx,2); % obtain x(n-2)
w = randn(1,length(y)); nw = ny; % generate w(n)
[y,ny] = sigadd(y,ny,w,nw); % obtain y(n)=x(n-2)+w(n)
[x,nx] = sigfold(x,nx); % obtain x(-n)
[rxy,nrxy] = conv_m(y,ny,x,nx); % crosscorrelation
subplot(2,1,2); stem(nrxy,rxy)
axis([-5,10,-50,250]);xlabel('lag variable 1')
ylabel('rxy'); title('crosscorrelation: noise sequence 2')
grid on

结果:

  

DSP using MATlAB 示例Example2.10的更多相关文章

  1. DSP using MATLAB 示例 Example3.10

    用到的性质 上代码: n = -5:10; x = rand(1,length(n)) + j * rand(1,length(n)); k = -100:100; w = (pi/100)*k; % ...

  2. DSP using MATLAB 示例Example2.12

    代码: b = [1]; a = [1, -0.9]; n = [-5:50]; h = impz(b,a,n); set(gcf,'Color','white'); %subplot(2,1,1); ...

  3. DSP using MATLAB 示例Example2.4

    n = [0:10]; x = stepseq(0,0,10) - stepseq(10,0,10); [xe,xo,m] = evenodd(x,n); set(gcf,'Color',[1,1,1 ...

  4. DSP using MATLAB 示例Example2.3

    n = [-10:1:10]; alpha = -0.1+0.3j; % x = exp(alpha*n); % subplot(2,1,1); set(gcf,'Color',[1,1,1]) % ...

  5. DSP using Matlab 示例Example2.2

    a. n = -2:10; x = [1:7,6:-1:1]; % generate x(n) [x11,n11] = sigshift(x,n,5); [x12,n12] = sigshift(x, ...

  6. DSP using MATLAB 示例Example2.11

    上代码: b = [1]; a = [1, -1, 0.9]; n = [-20:120]; h = impz(b,a,n); set(gcf,'Color','white'); %subplot(2 ...

  7. DSP using MATLAB 示例Example3.21

    代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*a ...

  8. DSP using MATLAB 示例 Example3.19

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...

  9. DSP using MATLAB示例Example3.18

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...

随机推荐

  1. ajax 删除一条数据

    代码: 对这一段话的理解:先找到需要删除的节点,以及节点里的文本:用Ajax 发送请求,请求方式为POST ,请求内容为需要删除记录的文件,dataType定义数据类型Json,通常都是Json,da ...

  2. 【linux】学习7

    鸟哥 22章内容 单个源代码编译运行 设有一个hello.c 可以用下面方式运行 生成可执行文件a.out [localhost scripts]$ gcc hello.c [localhost sc ...

  3. September 10th 2016 Week 37th Saturday

    An innovation that goes beyond imagination again raised the standard. 颠覆想象的创新,再一次刷新标准. An advertisem ...

  4. Python--set常用操作函数

    python提供了常用的数据结构,其中之一就是set,python中的set是不支持索引的.值不能重复.无需插入的容器. 简单记录下set常用的操作函数: 1.新建一个set: set("H ...

  5. Codeforces Round #344 (Div. 2)(按位或运算)

    Blake is a CEO of a large company called "Blake Technologies". He loves his company very m ...

  6. MVC学习笔记---ModelBinder

    http://www.cnblogs.com/terrysun/archive/2010/04/05/1704666.html http://www.cnblogs.com/aehyok/archiv ...

  7. web端跨域调用webapi

    在做Web开发中,常常会遇到跨域的问题,到目前为止,已经有非常多的跨域解决方案. 通过自己的研究以及在网上看了一些大神的博客,写了一个Demo 首先新建一个webapi的程序,如下图所示: 由于微软已 ...

  8. ****CodeIgniter使用cli模式运行,把php作为shell编程

    shell简介 在计算机科学中,Shell俗称壳(用来区别于核).而我们常说的shell简单理解就是一个命令行界面,它使得用户能与操作系统的内核进行交互操作. 常见的shell环境有:MS-DOS.B ...

  9. Myeclipse 2016 & 2014 下载

    myeclipse-2016-ci-6-offline-installer-windowshttps://downloads.genuitec.com/downloads/myeclipse/inst ...

  10. Java代码实现excel数据导入到Oracle

    1.首先需要两个jar包jxl.jar,ojdbc.jar(注意版本,版本不合适会报版本错误)2.代码: Java代码   import java.io.File; import java.io.Fi ...