《DSP using MATLAB》Problem 5.30

代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 5.29 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % --------------------------------------------------------
% x1(n) and x2(n) ---- N-point sequence
% y(n) = x1(n) Cir-Conv x2(n)
% --------------------------------------------------------
N = 8;
n1 = [0:N-1];
x1 = [9, 4, -1, 4, -4, -1, 8, 3];
N1 = length(x1); n2 = [0:N-1];
x2 = [-5, 6, 2, -7, -5, 2, 2, -2];
N2 = length(x2); sum_x1 = sum( x1( min(n1)+1 : max(n1)+1 ) )
sum_x2 = sum( x2( min(n2)+1 : max(n2)+1 ) ) answer = sum_x1 * sum_x2 % --------------------------------------------
% 1st way TIME domain
% --------------------------------------------
%N = 10;
n = [0:N-1]; y1 = circonvt(x1, x2, N);
sum_y1 = sum( y1( min(n)+1 : max(n)+1 ) ) % --------------------------------------------
% 2nd way ---- circular conv(FREQ domain)
% --------------------------------------------
y2 = circonvf(x1, x2, N);
sum_y2 = sum( y2( min(n)+1 : max(n)+1 ) ) % --------------------------------------------
% 3rd way --- Cir Conv (Circulant Matrix)
% --------------------------------------------
y3 = circonvt_v3(x1, x2, N);
sum_y3 = sum( y3( min(n)+1 : max(n)+1 ) ) figure('NumberTitle', 'off', 'Name', 'P5.29 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=8'); 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=8'); grid on; figure('NumberTitle', 'off', 'Name', 'P5.29 Cir-Conv, N=8')
set(gcf,'Color','white');
subplot(3,1,1); stem(n, y1);
xlabel('n'); ylabel('y1(n)');
title('Time Domain, y1(n)'); grid on;
subplot(3,1,2); stem(n, y2);
%axis([0, N, 0, 1]);
xlabel('n'); ylabel('y2(n)');
title('FREQ domain, y2(n)'); grid on;
subplot(3,1,3); stem(n, y3);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('n'); ylabel('y3(n)');
title('Circulant Matrix, y3(n)'); grid on;
运行结果:

圆周卷积结果,3种计算方法。


《DSP using MATLAB》Problem 5.30的更多相关文章
- 《DSP using MATLAB》Problem 8.30
10月1日,新中国70周岁生日,上午观看了盛大的庆祝仪式,整齐的方阵,先进的武器,尊敬的先辈英雄,欢乐的人们,愿我们的 国家越来越好,人民生活越来越好. 接着做题. 代码: %% ---------- ...
- 《DSP using MATLAB》Problem 7.30
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.23
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...
- 《DSP using MATLAB》Problem 5.22
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...
- 《DSP using MATLAB》Problem 5.20
窗外的知了叽叽喳喳叫个不停,屋里温度应该有30°,伏天的日子难过啊! 频率域的方法来计算圆周移位 代码: 子函数的 function y = cirshftf(x, m, N) %% -------- ...
- 《DSP using MATLAB》Problem 3.8
2018年元旦,他乡加班中,外面尽是些放炮的,别人的繁华与我无关. 代码: %% ----------------------------------------------------------- ...
- 《DSP using MATLAB》Problem 3.3
按照题目的意思需要利用DTFT的性质,得到序列的DTFT结果(公式表示),本人数学功底太差,就不写了,直接用 书中的方法计算并画图. 代码: %% -------------------------- ...
- 《DSP using MATLAB》Problem 2.20
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 2.14
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
随机推荐
- java的八大排序
public class Sort2 { public static void main(String[] args) { Sort2 sort = new Sort2(); System.out.p ...
- leetcode 刷题 数组类 Two Sum
---恢复内容开始--- Two Sum Given an array of integers ,find two numbers such that they add up to a specifi ...
- 菜鸟翻译:国外的一个关于.net core的学习系列 第一天(安装并运行.NET core 到windox系统里面)
原文地址: Day 1 - Installing and Running .NET Core on a Windows Box 免责声明:我不是.NET Core 的团队成员.我使用的工具是公开可用的 ...
- mysql存储过程造数
性能测试时,数据库表通常需要很多数据,此时我们可以用存储过程来造数,以下代码mysql.Oracle都可以用 首先,先查看数据库表的设计,可以看到每张表有多少字段,分别都是什么类型,哪个字段是自动增长 ...
- Centos7单主机部署 LAMP + phpmyadmin 服务
LAMP -> centos + apache + mysql + php + phpmyadmin 一:搭建yum仓库: 安装utils: yum -y install yum-utils c ...
- 记录搭建ssm项目
搞java也快3年了,搭建一个ssm居然有点吃力. 参考链接:https://blog.csdn.net/gebitan505/article/details/44455235/ 环境准备:jdk8. ...
- 转--HC05-两个蓝牙模块间的通信
示例蓝牙: 蓝牙A地址:3014:10:271614 蓝牙B地址:2015:2:120758 //============================================= 步骤: 1 ...
- ALTER语句重命名,重新定义和重新排序列
该CHANGE,MODIFY和 ALTER子句可以改变现有列的名称和定义.他们有这些比较特征: CHANGE: 可以重命名列并更改其定义,或两者都可以. 具有更多的能力MODIFY,但是以某些操作的便 ...
- chromium ①
Chrome源码剖析 [序] && [一] 1. 它是如何利用多进程(其实也会有多线程一起)做并发的, 进程间通信,进程的开销:2. 做为一个后来者,它的扩展能力如何 3. 它的整体框 ...
- UUID自动生成
(uuid,available,createtime) select left(replace(uuid(), '-', ''),24),1,utc_timestamp() 使用: ),,utc_t ...