上代码

% 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. sql server 行转列(转载)

    SQL Server中行列转换 Pivot UnPivot PIVOT用于将列值旋转为列名(即行转列),在SQL Server 2000可以用聚合函数配合CASE语句实现 PIVOT的一般语法是:PI ...

  2. 【编程题目】如何对n个数进行排序,要求时间复杂度O(n),空间复杂度O(1)

    转自:http://blog.csdn.net/vast_sea/article/details/8167968 看上去似乎任何已知的算法都无法做到,如果谁做到了,那么所有的排序方法:QuickSor ...

  3. self dismissModalViewControllerAnimated:YES 无效(dismissviewcontrolleranimated无效)

    作为一个viewController(VC),想要消失的时候可以从parent VC里面调用dismissModalViewControllerAnimated来消去改VC,也可以在该VC里面手动调用 ...

  4. August 21st 2016 Week 35th Sunday

    I figure life is a gift and I don't intend on wasting it. 我觉得生命是一份礼物,我不想浪费它. Tonight when I was runn ...

  5. ui组件--弹出层layer的使用

    帮助文档 下载地址 演示地址

  6. Stanford大学机器学习公开课(二):监督学习应用与梯度下降

    本课内容: 1.线性回归 2.梯度下降 3.正规方程组   监督学习:告诉算法每个样本的正确答案,学习后的算法对新的输入也能输入正确的答案   1.线性回归 问题引入:假设有一房屋销售的数据如下: 引 ...

  7. php 分页查询

    get方法 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  8. MVC缓存03,扩展方法实现视图缓存

    关于缓存,先前尝试了: ● 在"MVC缓存01,使用控制器缓存或数据层缓存"中,分别在控制器和Data Access Layer实现了缓存 ● 在"MVC缓存02,使用数 ...

  9. I-number

    以下是真坑爹题目: 此题必须输出前导零,否则永远a不了 I-number Time Limit: 5000MS Memory limit: 65536K 题目描述 The I-number of x ...

  10. 使用getopt函数对windows命令行程序进行参数解析

    getopt()是libc的标准函数,很多语言中都能找到它的移植版本. // -b -p "c:\input" -o "e:\test\output" bool ...