《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 ...
随机推荐
- IO多路复用,select、poll、epoll 编程主要步骤
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- Java集合排序方法comparable和comparator的总结
一.概述Comparable和Comparator都是用来实现集合中元素的比较.排序的.Comparable是在集合内部定义的方法实现的排序,位于java.lang下.Comparator是在集合外部 ...
- [leetcode53]最长子数组 Maximum Subarray Kadane's算法
[题目] Given an integer array nums, find the contiguous subarray (containing at least one number) whic ...
- 查看电脑安装的JDK版本
1.输入java -d32 -version,若出现如下界面则是32位 2.java -d64 -version,因为是32位的,所以结果如下
- 记录搭建ssm项目
搞java也快3年了,搭建一个ssm居然有点吃力. 参考链接:https://blog.csdn.net/gebitan505/article/details/44455235/ 环境准备:jdk8. ...
- java.util.concurrent ThreadPoolExecutor源码分析
实现的接口:Executor, ExecutorService 子类:ScheduledThreadPoolExecutor 这类为java线程池的管理和创建,其中封装好的线程池模型在Executor ...
- git相关知识点
git add 和 git stage 有什么区别: 工作区(Working Directory).暂存区(Stage)和历史记录区(History)以及转换关系不能少: git stage 是 gi ...
- Python 基础数据类型相互转换
字符串,数字,列表 ,元祖,字典 化相互转化 1 Int 与 str 之间如何转化,转换的结果是什么?有没有条件? #str(int型)可以转化为str 该过程没有条件 #字符串转化为 ...
- 使用std::map和std::list存放数据,消耗内存比实际数据大得多
使用std::map和std::list存放数据,消耗内存比实际数据大得多 场景:项目中需要存储一个结构,如下程序段中TEST_DATA_STRU,结构占24B.但是使用代码中的std::list&l ...
- php session_start()
session_start()后 对应的session文件是被锁定的,直到当前脚本结束才会解锁.在锁定期间,令一个进程访问相同session id 要等文件解锁后session_start()才会开始 ...