《DSP using MATLAB》Problem 5.27


代码:
%% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 5.27 \n\n'); banner();
%% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % -------------------------------------------------------------------
%
% -------------------------------------------------------------------
N = 4;
n1 = [0:3];
x1 = [1, 3, 2, -1]; n2 = [0:3];
x2 = [2, 1, 0, -1]; % -----------------------------------
% 1st way to Linear-Convolution
% -----------------------------------
[y1, ny1] = conv_m(x1, n1, x2, n2); % --------------------------------------------
% 2nd way ---- circular conv(FREQ domain)
% --------------------------------------------
N2 = length(x1)+length(x2)-1;
y2 = circonvf(x1, x2, N2);
ny2 = ny1; % ---------------------------------------
% 3rd way --- Cir Conv (TIME domain)
% ---------------------------------------
N3 = length(x1)+length(x2)-1;
y3 = circonvt(x1, x2, N3);
ny3 = ny1; N4 = 5;
y4 = circonvt(x1, x2, N4);
ny4 = [0:N4-1]; figure('NumberTitle', 'off', 'Name', 'P5.27 x1(n) and x2(n)')
set(gcf,'Color','white');
subplot(2,1,1); stem(n1, x1);
xlabel('n'); ylabel('x1(n)');
title('x1(n), N=4'); 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), N=4'); grid on; figure('NumberTitle', 'off', 'Name', 'P5.27 Convolution')
set(gcf,'Color','white');
subplot(2,2,1); stem(ny1, y1);
xlabel('n'); ylabel('y1(n)');
title('Linear-Conv y1(n), N=7'); grid on;
subplot(2,2,2); stem(ny2, y2);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('n'); ylabel('y2(n)');
title('Cir-Conv(FREQ domain) y2(n), N=7'); 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(TIME domain) y3(n), N=7'); grid on;
subplot(2,2,4); stem(ny4, y4);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('n'); ylabel('y4(n)');
title('Cir-Conv(TIME domain) y4(n), N=5'); grid on;
运行结果:



上图中,y1是长度为7的线性卷积结果,y4是5点圆周卷积结果。
《DSP using MATLAB》Problem 5.27的更多相关文章
- 《DSP using MATLAB》Problem 7.27
		
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
 - 《DSP using MATLAB》Problem 8.27
		
7月底,又一个夏天,又一个火热的夏天,来到火炉城武汉,天天高温橙色预警,到今天已有二十多天. 先看看住的地方 下雨的时候是这样的 接着做题 代码: %% ----------------------- ...
 - 《DSP using MATLAB》Problem 7.23
		
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...
 - 《DSP using MATLAB》Problem 7.16
		
使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
 - 《DSP using MATLAB》Problem 7.38
		
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
 - 《DSP using MATLAB》Problem 7.36
		
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
 - 《DSP using MATLAB》Problem 7.32
		
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
 - 《DSP using MATLAB》Problem 7.31
		
参照Example7.27,因为0.1π=2πf1 f1=0.05,0.9π=2πf2 f2=0.45 所以0.1π≤ω≤0.9π,0.05≤|H|≤0.45 代码: %% +++++++++ ...
 - 《DSP using MATLAB》Problem 7.26
		
注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
 
随机推荐
- javaweb环境搭建
			
首先,在开始搭建MyEclipse的开发环境之前,还有三步工具的安装需要完成,只要在安装配置成功之后才可以进入下面的java Web项目开发环境的搭建. 1.安装工具 第一步,下载并安装JDK,到官网 ...
 - OO Summary Ⅳ
			
测试与正确性论证的效果差异 测试,或者说用断言进行黑箱测试,用大量的数据进行“覆盖性测试”,目的是当分支覆盖率达到100%也就是理论上来说所有可能的输入都已经测试过了,而输出结果均是正确的,那么我们理 ...
 - MySQL5.6数据库8小时内无请求自动断开连接
			
问题: 最近的项目中,发现Mysql数据库在8个小时内,没有请求时,会自动断开连接,这是MySQL服务器的问题.The last packet successfully received from t ...
 - 3.1 Makefile
			
安装make 安装make sudo apt-get install make make -v
 - 四:(之三)制作镜像和一些docker命令
			
3.DIY image 3.1如何去掉sudo权限命令,让当前用户拥有操作docker的权限? 3.2 制作一个image: 拉取一个非常小的base image,hello-world.其中是一个可 ...
 - 准备下上机考试,各种排序!!以后再添加和仿真像wiki上那样!
			
#include <stdio.h> #include <string.h> #define N 6 typedef struct { ]; int score; }stude ...
 - 强震记录和GPS记录,地震波记录的区别
			
强震记录的是加速度数据,但gps记录的是位移数据.这样的话,强震记录应该说是近场地震数据: 那么, 为什么不干脆用近场的地震波仪器呢,是因为,地震仪记录会限幅,导致记录不全.
 - SpringMVC学习一
			
先看SpringMVC的视图解析 以及 摘录自http://www.cnblogs.com/HigginCui/p/5856780.html的架构解析 1.DisPatcherServlet:前 ...
 - 基于spec互评Alpha版本
			
作业要求[https://edu.cnblogs.com/campus/nenu/2018fall/homework/2323] 队名:二次元梦之队 组长:刘莹莹 组员:周昊 潘世维 王玉潘 赵美增 ...
 - nginx 更改用户组
			
为什么要更改 Nginx 服务的默认用户:就像更改 ssh 的默认 22 端口一样,增加安全性,Nginx 服务的默认用户是 nobody ,我们更改为 nginx 1) 添加 nginx 用户 us ...