《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,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
随机推荐
- linux文件管理 文件搜索
文件搜索命令find 'find [搜索范围] [搜索条件]' 搜索文件 find / -name install.log #避免大范围搜索,会非常消耗系统资源 #find是在系统当中搜索符合条件的文 ...
- Uva LV 2995 Image Is Everything 模拟,坐标映射,视图映射 难度: 1
题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_pr ...
- asp.netmvc 三层搭建一个完整的项目
接下来用 asp.net mvc 三层搭建一个完整的项目: 架构图: 使用的数据库: 一张公司的员工信息表,测试数据 解决方案项目设计: 1.新建一个空白解决方案名称为Company 2.在该解决方案 ...
- 前端基础之jQuery操作标签
一.样式操作 样式类 addClass(); // 添加指定的CSS类名. removeClass(); // 移除指定的CSS类名. hasClass(); // 判断样式存不存在 toggleCl ...
- 总结小bug
1.下拉刷新问题 //不要用scroll-view 他会阻止刷新 //改用view <template name="movieGridTemplate"> <!- ...
- [转]如何远程连接运行OpenGL/Cuda 等GPU程序
发现一篇神文,解决了困扰许久的远程桌面OpenGL/GPU 等问题... 原地址在这:http://www.tanglei.name/how-to-run-gpu-programs-using-rem ...
- linux 创建安装redis服务
1.找下redis的官方的下载地址:http://download.redis.io/releases/redis-3.2.8.tar.gz 有最新的就下载最新 先下载解压跟安装 wget http ...
- TLS反调试
0x01 TLS反调试简介 TLS(Thread Local Storage)原本的目的是解决多线程程序中变量同步的问题.线程本身有独立于其他线程的栈空间,因此线程中的局部变量不用考虑同步问题.多线程 ...
- python的编码与转码
编码问题一直是初学者的难题,搞不明白.甚至一些程序员做了多年的程序,但是编码一直整不清,下面就来认识认识编码吧. ASCII(American Standard Code for Informatio ...
- hdu5335(bfs,贪心)
In an n∗mn∗m maze, the right-bottom corner is the exit (position (n,m)(n,m) is the exit). In every p ...