《DSP using MATLAB》Problem5.33

代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 5.33 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % -------------------------------------------------------------
% x3(n) --- N-point circular convolution of x1(n) an x2(n)
% x4(n) --- Linear convolution
% e(n) --- error sequence
% ------------------------------------------------------------- N = 8;
n1 = [0:3];
x1 = [2, 1, 1, 2];
N1 = length(x1); n2 = [0:3];
x2 = [1, -1, -1, 1];
N2 = length(x2); % --------------------------------------------
% 1st way ---- time domain
% --------------------------------------------
N
y1 = circonvt(x1, x2, N)
ny1 = [0:N-1]; % --------------------------------------------
% 2nd way ---- DFT method
% -------------------------------------------- y2 = circonvf(x1, x2, N);
ny2 = [0:N-1]; % --------------------------------------------
% 3rd way --- circulant matrix
% -------------------------------------------- y3 = circonvt_v3(x1, x2, N);
ny3 = [0:N-1]; % ---------------------------------------
% Linear convolution
% --------------------------------------- [y4, ny4] = conv_m(x1, n1, x2, n2); %e1 = y1 - y4(1:N); figure('NumberTitle', 'off', 'Name', 'P5.33 x1(n) and x2(n) N=4')
set(gcf,'Color','white');
subplot(2,1,1); stem(n1, x1);
xlabel('n'); ylabel('x1(n)');
title('x1(n)'); grid on;
subplot(2,1,2); stem(n2, x2);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('n'); ylabel('x2(n)');
title('x2(n)'); grid on; figure('NumberTitle', 'off', 'Name', 'P5.33 Cir-Conv(N=8) and Linear-Conv')
set(gcf,'Color','white');
subplot(2,2,1); stem(ny1, y1);
xlabel('n'); ylabel('y1(n)');
title('Cir-Conv (Time domain), y1(n)'); grid on;
subplot(2,2,2); stem(ny2, y2);
%axis([0, N, 0, 1]);
xlabel('n'); ylabel('y2(n)');
title('Cir-Conv (DFT method), y2(n)'); grid on;
subplot(2,2,3); stem(ny3, y3);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('n'); ylabel('y3(n)');
title('Cir-Conv (circulant matrix), y3(n)'); grid on;
subplot(2,2,4); stem(ny4, y4);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('n'); ylabel('y4(n)');
title('Linear-Conv, y4(n)'); grid on;
运行结果:


y1--圆周卷积,N=4;y4---线性卷积,长度为7


由下图可知,当N=7时,序列的圆周卷积和线性卷积结果相同。



结论:两序列x1长N1,x2长N2,当N至少取N1+N2-1做圆周卷积,结果和线性卷积相同。
《DSP using MATLAB》Problem5.33的更多相关文章
- 《DSP using MATLAB》Problem5.23
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...
- 《DSP using MATLAB》Problem5.16
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》示例Example7.25
今天清明放假的第二天,早晨出去吃饭时天气有些阴,十点多开始“清明时节雨纷纷”了. 母亲远在他乡看孙子,挺劳累的.父亲照顾生病的爷爷…… 我打算今天把<DSP using MATLAB>第7 ...
- 《DSP using MATLAB》Problem 8.33
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 7.33
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》示例 Example 9.14
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》 示例 Example 9.12
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》示例Example 9.9
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》示例 Example 9.6
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
随机推荐
- U启动制作U盘启动盘详细教程
第一步 打开u启动装机版,将准备好的u盘插入电脑usb接口并静待软件对u盘进行识别,由于此次u启动采用全新功能智能模式,可为u盘自动选择兼容性强与适应性高的方式进行制作,相较过去版本可省去多余的选择操 ...
- Oracle数据库备份策略:全备与增量备份
一.RMAN全备份 在数据量比较小.或者数据库服务器性能很强大的情况下,可以每天进行一次全备份. 全被策略如下 1.crontab定时任务,避开业务繁忙时段 ##################### ...
- day039 数据库索引
今日内容: 1.为什么要有索引 简而言之,索引出现的意义是为了更方便,更快速的查询数据. 什么是索引 索引在mysql中也叫''键''或'key'(primary key unique key,ind ...
- JavaScrip(二)JavaScrip语法基础
一:标识符 标识符是指变量,函数的名字,或函数的参数名: 1.命名规则 1.1第一个字符必须是一个字母.下划线(_).或一个美元符号($) 1.2其他字母可以是字母,下划线.美元符号或数字 1.3不能 ...
- maven scope和项目发布需要注意的地方
Maven Scope的使用: http://www.cnblogs.com/wangyonghao/p/5976055.html servlet-api和jsp-api等jar包,一般由servle ...
- Linux3.10.0块IO子系统流程(2)-- 构造、排序、合并请求
Linux块设备可以分为三类.分别针对顺序访问物理设备.随机访问物理设备和逻辑设备(即“栈式设备”) 类型 make_request_fn request_fn 备注 SCSI 设备等 从bio构 ...
- MVC扩展之HtmlHelper辅助方法
1.什么是HtmlHelper辅助方法?其实就是HtmlHelper类的扩展方法,如下所示: namespace System.Web.Mvc.Html { public static class F ...
- TensorFlow随机值:tf.random_normal函数
tf.random_normal 函数 random_normal( shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=No ...
- Metasploit的射频收发器功能 | Metasploit’s RF Transceiver Capabilities
https://community.rapid7.com/community/metasploit/blog/2017/03/21/metasploits-rf-transceiver-capabil ...
- pycharm 永久解封
第一步 c:\windows\system32\drivers\etc 命令行输入这个 第二步 把host文件复制到桌面 第三步 记事本打开host 第四步 在最下面添加 ...