杭电_数字信号处理课程设计_实验1.rar 适用于理工科高校大学生,数字信号处理课程设计(实验课)作为参考。该资源于本人csdn博客(实则是实验报告)同步更新,若有错误,还请HXD们指正。 一、实验目的 实验三目的: 二、实验要求及内容 实验一循环卷积通用程序: 实验三: 实验三FFT数字滤波器通用程序: 三、实验结果与分析: 四、实验总结:
杭电_数字信号处理课程设计_实验1
实验一目的:
1、掌握计算机的使用方法和常用系统软件及应用软件的使用。
2、通过MATLAB编程,上机调试程序,进一步增强使用计算机解决问题的能力。
3、掌握线性卷积与循环卷积软件实现的方法,并验证二者之间的关系。
1、通过这一实验,加深理解FFT在实现数字滤波(或快速卷积)中的重要作用,更好的利用FFT进行数字信号处理。
2、进一步掌握循环卷积和线性卷积两者之间的关系。
实验一:
实验一代码:clear all x1 = [1 2 3 4 5]; x2 = [1 2 1 2]; N = 5; ycn1=circonv(x1,x2,N); ny1=[0:1:length(ycn1)-1]; subplot(3,2,1); stem(ny1,ycn1); ylabel("循环卷积1:N=5") axis([0,9,0,25]); N = 6; ycn2=circonv(x1,x2,N); ny2=[0:1:length(ycn2)-1]; subplot(3,2,2); stem(ny2,ycn2); ylabel("循环卷积2:N=6") axis([0,9,0,25]); N = 9; ycn3=circonv(x1,x2,N); ny3=[0:1:length(ycn3)-1]; subplot(3,2,3); stem(ny3,ycn3); ylabel("循环卷积3:N=9") axis([0,9,0,25]); N = 10; ycn4=circonv(x1,x2,N); ny4=[0:1:length(ycn4)-1]; subplot(3,2,4); stem(ny4,ycn4); ylabel("循环卷积4:N=10") axis([0,9,0,25]); y1n=conv(x1,x2); L_length = length(x1)+length(x2)-1-1; ny5 = [0:1:L_length]; subplot(3,2,5); stem(ny5,y1n); ylabel("线性卷积") axis([0,9,0,25]);
function yc = circonv(x1,x2,N) if length(x1)>N error('N must not be less than length of x1'); end if length(x2)>N error('N must not be less than length of x1'); end %以上语句判断两个序列的长度是否小于N x1 = [x1,zeros(1,N-length(x1))]; %填充序列x1(n)使其长度为N1+N2-1 x2 = [x2,zeros(1,N-length(x2))]; %填充序列x2(n)使其长度为N1+N2-1 n = [0:1:N-1]; x2 = x2(mod(-n,N)+1); %生成序列x2((-n))N H = zeros(N,N); for n = 1:1 :N H(n,:) = cirshiftd(x2,n-1,N); %该矩阵的k行为x2((k-1-n))N end yc = x1 * H'; %计算循环卷 function y = cirshiftd(x,m,N) if length(x)>N error('length of x must be less than N'); end x = [x,zeros(1,N-length(x))]; n = [0:1:N-1]; y = x(mod(n-m,N)+1);
实验三代码:clear all; N1 = 16; N2 = 17; N = N1 + N2 - 1; n = [0:1:N1-1]; h = [0:1:N2-1]; nx = [0:1:N-1]; xn1 = ones(1,N1); xn2 = cos(2*pi/N1*n); xn3 = (1/3).^n; hn = (1/2).^h; yn1 = fft_conv(xn1,hn,N); yn2 = fft_conv(xn2,hn,N); yn3 = fft_conv(xn3,hn,N); subplot(3,1,1); stem(nx,yn1); ylabel("序列1") axis([0,32,0,2.5]); subplot(3,1,2); stem(nx,yn2); ylabel("序列2") axis([0,32,-2,2]); subplot(3,1,3); stem(nx,yn3); ylabel("序列3") axis([0,32,0,1.1]);
function yn = fft_conv(xn,hn,N) if length(xn)>N error('N must not be less than length of x1'); end if length(hn)>N error('N must not be less than length of x1'); end if rem(log2(N),1)~=0 error('N must be the power of 2'); end xn = [xn,zeros(1,N-length(xn))]; hn = [hn,zeros(1,N-length(hn))]; XK = fft(xn,N); HK = fft(hn,N); YK = XK.*HK; yn = ifft(YK,N); if (all(imag(xn)==0)) && (all(imag(hn)==0)) yn = real(yn); else error('xn,hn may not be real array'); end
实验一结果:
该实验结果与笔算结果相同,符合题目要求。
实验三结果:
该实验结果与笔算结果相同,符合题目要求。
本次实验使我认识到了用工具解决DSP问题的方便性,专业性及快捷性,使我对matlab的认识更加深入,对于数字信号处理的相关知识的领悟更加明白,但是我在编写代码的过程同样遇到了一些问题,比如定义函数的时候,文件名要和函数名相同,否则无法调用函数而运行报错。而且自定义的函数,和编写的主程序最好放在同一个文件夹,以免因为路径不同而导致运行出错。
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算