《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,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
随机推荐
- 认识微软Visual Studio Tools for AI
认识微软Visual Studio Tools for AI 微软已经发布了其 Visual Studio Tools for AI 的测试版本,这是微软 Visual Studio 2017 I ...
- Java反射《二》获取构造器
package com.study.reflect; import java.lang.reflect.Constructor; import java.lang.reflect.Invocation ...
- poj3261
题解: 同bzoj1717 代码: #include<bits/stdc++.h> using namespace std; ,P2=,P=; int a1[P],num[P],a2[P] ...
- bzoj1679
题解: 前缀和 显然需要排序一下 注意爆int这件事 代码: #include<bits/stdc++.h> using namespace std; typedef long long ...
- mybatis实战教程
参考:http://blog.csdn.net/techbirds_bao/article/details/9233599/
- dell win10 productkey
- java接口和抽象类的区别和作用(功能、用途、好处)
Java接口: 总结了4点关于JAVA中接口存在的意义: 1.重要性:在Java语言中, abstract class 和interface 是支持抽象类定义的两种机制.正是由于这两种机制的存在,才赋 ...
- Mysql中contact、group_concat、concat_ws、repeat
一.CONCAT(str1,str2,…) 返回结果为连接参数产生的字符串.如有任何一个参数为NULL ,则返回值为 NULL. mysql> select concat('11','22',' ...
- python常用内建模块 collections,bs64,struct,hashlib,itertools,contextlib,xml
# 2 collections 是Python内建的一个集合模块,提供了许多有用的集合类. # 2.1 namedtuple #tuple可以表示不变集合,例如,一个点的二维坐标就可以表示成: p ...
- python中的__call__()函数
__call__ 在Python中,函数其实是一个对象: >>> f = abs >>> f.__name__ 'abs' >>> f(-123) ...