《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 ...
随机推荐
- shutil 模块
import shutil #用于简化文件操作的模块 # f1 = open(r"D:\上海python全栈4期\day20\7.shutil模块.py","rb&quo ...
- oo作业总结报告
oo第一次博客 以前从未真正的写过Java代码,接触Java也只是寒假的时候简单的看了看语法,不懂该如何面向对象,但没事,心里不惧,想着什么都是可以学的(直到真正开始写工程的时候,才发现自己还是太天真 ...
- EF-记录程序自动生成并执行的sql语句日志
在EntityFramework的CodeFirst模式中,我们想将程序自动生成的sql语句和执行过程记录到日志中,方便以后查看和分析. 在EF的6.x版本中,在DbContext中有一个Databa ...
- ADO.NET 连接池 Session 状态分析
ADO.NET 中提供连接池避免 在业务操作中频繁打开,关闭连接. 当客户端释放连接后,连接池并未真正将数据库连接资源释放 , 而是根据连接字符串特征,将资源放到连接池中, 方便下次重用. 因此问题来 ...
- core net 2 nuget的数据源包
基本都是 在 obj里面 debug里面 porgect.assetc.json
- Java的file类
package IO; import java.io.File; import java.io.IOException; public class FileDemo01 { public static ...
- js 将文本转换为数据 string number
<span class="Span" > <p>123.81</p> <a> dejiw</a> </span&g ...
- 手打struts知识点
Struts2概论 1.MVC原理 MVC(Model-View-Controller),程序设计理念 视图不用多说,html.jsp等 控制器,中转站,分配各个组件应当做什么,接受参数并跳转其他处理 ...
- rancher中使用ingress-lbs做负载均衡
rancher 相关资料 http://rancher.com/docs/rancher/v1.6/zh/kubernetes/ingress/ lvs, haproxy, nginx负载均衡器比较 ...
- File类操作中的IOException异常
代码: File file= newFile("demo"+File.separator+"HelloWorld.txt"); file.createNe ...