代码:

%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% 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种计算方法。

最新文章

  1. java-集合3
  2. bootstrap学习总结-01 环境准备
  3. js中获取css属性
  4. C++的那些事:函数全解析
  5. win764上vs2010+opencv2.4.11安装配置
  6. nginx+lua+redis初体验
  7. Spring MVC mapping[From Spring MVC Beginner&#39;s Guide]
  8. HDU 4618 Palindrome Sub-Array (2013多校2 1008 暴力)
  9. hdu 4412 利用单调性的动态规划
  10. Sina App Engine(SAE)教程(11)- Yaf使用
  11. (转)Qt Model/View 学习笔记 (四)——创建新的Models
  12. IOS 设备信息读取
  13. TensorFlow官方文档
  14. Python数据结构应用3——链表
  15. Cloud Native 云化架构阅读笔记
  16. Unexpected character &#39;�&#39; (1:0) while parsing file
  17. search
  18. c# .Net随机生成字符串代码
  19. git将本地项目推送到远程仓库
  20. PopupWindow 学习总结

热门文章

  1. shell脚本分析一
  2. git教程(全)
  3. 最完整的mac安装caffe
  4. RabbitMQ 循环调度
  5. c语言中printf("%x",-1);为什么会输出-1的十六进制补码??
  6. 打开和写入word文档
  7. Java的file类
  8. SQL-17 获取当前(to_date=&#39;9999-01-01&#39;)薪水第二多的员工的emp_no以及其对应的薪水salary
  9. 201621123001 《java程序设计》 第3周学习总结
  10. SharePoint Framework 构建你的第一个web部件(一)