《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 ...
随机推荐
- Win10系列:JavaScript页内导航
页内导航是在一个页面内根据需要加载其他页面的内容,在开发基于JavaScript的Windows应用商店应用时,可以使用WinJS.Navigation.navigate函数传递要加载的页面地址并使用 ...
- int(a) 和 (int &) a 及 数据存储地址的探究
做题做到一个很有意思的题 void main() { float a = 1; cout << boolalpha << ((int)a == (int &)a); f ...
- Gameobject.Find和Transform.Find应用区别
using UnityEngine;using System.Collections; public class test : MonoBehaviour{ private GameObject ro ...
- Java 集成开发环境的介绍及下载
集成开发环境(integrated development environment,JDE) 之前成功运行了Java小程序是经历了先在笔记本中编写源代码,然后通过命令行运行打开javac编译源文件, ...
- :组合模式:Component
#ifndef __COMPONENT_H__ #define __COMPONENT_H__ #include <iostream> #include <vector> us ...
- 3.7 C++派生类构造函数调用规则
参考:http://www.weixueyuan.net/view/6364.html 总结: 派生类构造函数可以自动调用基类的默认构造函数而无需显式调用. 生类构造函数可以自动调用基类的默认构造函数 ...
- 一步一步开始FPGA逻辑设计 - 高速接口之PCIe(转)
reference: https://blog.csdn.net/jackxu8/article/details/53288385 这篇文章主要针对Xilinx家V6和K7两个系列的PFGA,在Lin ...
- L309 单音节词读音规则(一)-辅音字母发音规则
1 字母和音素不是一一对应的 2单词读音规则知识结构全图 二 15个发音不变化的辅音字母:字母发音和音素一致 b / b / by d / d / dog f / f / fish h ...
- http 性能测试. Apache ab 使用.
参数: 1. ab -n 100 -c 10 地址: 请求100次, 并发10次. 2. ab -n 100 -c 10 -w 地址: 请求100次, 并发10次 ,html 表 ...
- usort 函数
function getNameFromNumber($num){ // Used to figure out what the Excel column name would be for a gi ...