《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,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
随机推荐
- mybatis if标签判断字符串相等
mybatis 映射文件中,if标签判断字符串相等,两种方式: 因为mybatis映射文件,是使用的ognl表达式,所以在判断字符串sex变量是否是字符串Y的时候, <if test=" ...
- python列表、集合、元祖、字典推导式
a = [1, 2, 3, 4, 5, 6, 7, 8]l=[i**2 for i in a if i**2>=16] #列表推导式+if判断print(l)print(type(l)) b={ ...
- SpringMVC @RequestParam和@RequestBody的区别
问题:@Requestbody 用的时候遇到400和415错误,因为请求格式不对. @RequestBody @RequestBody能把简单json结构参数转换成实体类,如下代码: @Request ...
- SharePoint Framework 企业向导(七)
博客地址:http://blog.csdn.net/FoxDave 企业中的SPFx SharePoint是最成功的企业协作平台之一,能够成功的其中一点是它能够进行扩展并作为一个应用集成平台.SP ...
- poj3279(dfs+二进制枚举思路)
题意转载自https://www.cnblogs.com/blumia/p/poj3279.html 题目属性:DFS 相关题目:poj3276 题目原文:[desc]Farmer John know ...
- 基于spec互评Alpha版本
作业要求[https://edu.cnblogs.com/campus/nenu/2018fall/homework/2323] 队名:二次元梦之队 组长:刘莹莹 组员:周昊 潘世维 王玉潘 赵美增 ...
- Oracle审计策略例子
首先确保Oracle初始化参数audit_trail值为DB或OS,通过“show parameter audit_trail:”查看. 1 语句审计 audit table by test by a ...
- day 41 mysql 函数 事物
mysql 函数 事务 mysql 中提供了许多内置函数 CHAR_LENGTH(str) 返回值为字符串str 的长度,长度的单位为字符.一个多字节字符算作一个单字符. 对于一个包含五个二字节字 ...
- nginx——优化 Nginx worker 进程数
Nginx 有 Master 和 worker 两种进程,Master 进程用于管理 worker 进程,worker 进程用于 Nginx 服务 worker 进程数应该设置为等于 CPU 的核数, ...
- 2017MySQL中文索引解决办法 自然语言处理(N-gram parser)
问题:长期以来MYSQL搜索对于中文来说不太理想,InnoDB引擎对FULLTEXT索引的支持是MySQL5.6新引入的特性,但是用“初级”一词在“我是一名初级开发者”搜索时是无法出现结果的,原因在于 ...