您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > 基于Matlab的数字信号处理课程设计课程报告
基于Matlab的数字信号处理课程设计一、课程设计目的:1.熟悉Matlab运行环境,熟练使用Matlab语言进行编程,进行数字信号处理。2.全面复习数字信号课程所学理论知识,巩固所学知识重点和难点,将理论与实践很好地结合起来。3.提高综合运用所学知识独立分析和解决问题的能力;二、MATLAB简介MATLAB是功能强大的科学及计算软件,它不但具有以矩阵计算为基础的强大数学计算和分析功能,而且还具有丰富的可视化图形表现功能和方便的程序设计能力。MATLAB的应用领域极为广泛,除了数学计算和分析外,还被广泛地应用于自动控制、系统仿真、数字信号处理、图形图像分析、数理统计、人工智能、虚拟现实技术、通信工程、金融系统等领域,因此,MATLAB是面向21世纪的计算机程序设计及科学计算语言。三、MATLAB的主要组成部分MATLAB系统包括5个主要部分:(1)开发环境MATLAB开发环境由一组工具和组件组成,这些工具是图形化的用户界面,包括MATLAB桌面和命令窗口、命令历史窗口、帮助信息浏览器、文件和搜索路径浏览器。(2)MATLAB数学函数库MATLAB集成了丰富的数学函数库,其强大的计算能力覆盖了从基本函数(如求和、正弦、余弦和复数运算等)到高级函数(如矩阵求逆、矩阵特征值、贝塞尔函数和快速傅立叶变换等)的范围。(3)MATLAB语言MATLAB语言是一种以矩阵运算为基础的高级语言,包括控制流的描述、函数、数据结构、输入输出及面向对象的编程环境,既可以编制快速使用小程序,也可以编制大型复杂的应用程序。(4)图形功能MATLAB提供了功能强大的图形系统,既可以用高级命令完成二维和三维数据的可视化、图像处理、动画和图形表达等功能,也可以通过使用图形句柄完成复杂的图形功能,实现对所有图形对象的操作。(5)应用程序接口(API)MATLAB还提供了应用程序接口库函数,允许用户使用C或FORTRAN语言编写程序与MATLAB连接,功能包括与MATLAB的动态连接、调用MATLAB作为运算引擎、读写MAT文件等。MATLAB的广泛应用促进了其本身功能的迅速发展,以特定领域的应用为主要目的的应用程序——工具箱的数量和内容在不断增多。四、利用Matlab熟悉画图(设计1)1、设计内容:能够利用Matlab熟悉地画图,内容包括:X、Y坐标轴上的label,每幅图上的title,绘画多条曲线时的legend,对图形进行适当的标注等。(1)在一副图上画出多幅小图;(2)画出一组二维图形;(3)画出一组三维图形;(4)画出复数的实部与虚部。1.实验结果:(1)、在一副图上画出多幅小图;-4-2024-1-0.500.51-1-0.500.5101020304050-4-20240510152025-4-2024-0.500.5(2)、画出一组二维图形;01234567-3-2-10123xy多条曲线绘制y=1*sin(x)y=2*sin(x)y=3*sin(x)(3)、画出一组三维图形;-505-505-2-1012xz=sin2(x)/(3*y-2)yz(4)、画出复数的实部与虚部;0.20.40.60.813021060240902701203001503301800(5)、完成对一个源程序进行详细注释。(见程序)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%能够利用Matlab熟悉地画图,内容包括:X、Y坐标轴上的label,%每幅图上的title,绘画多条曲线时的legend,对图形进行适当的标注等。%(1)在一副图上画出多幅小图;(2)画出一组二维图形;%(3)画出一组三维图形;(4)画出复数的实部与虚部。%(5)完成对一个源程序进行详细注释。%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear;clc;x=linspace(-pi,pi,200);%定义x轴坐标y1=sin(x);%函数1y2=cos(x);%函数2y3=exp(x);%函数3y4=sin(x).*cos(x);%函数4%%%%%%%%%%%%%%%%%%%%%%%%%在一幅图上绘制多幅小图%%%%%%%%%%%%%%%%%%%%%%%%%%%%figure(1)subplot(221),%图一plot(x,y1);%绘制y1gridon;%添加网格%axis([min(x)max(x)min(y1)max(y1)]);%指定显示范围subplot(222),%图二hist(y2);%绘制y2gridon;%添加网格%axis([min(x)max(x)min(y2)max(y2)]);%指定显示范围subplot(223),%图三stem(x,y3);%绘制y3gridon;%添加网格%axis([min(x)max(x)min(y3)max(y3)]);%指定显示范围subplot(224),%图四plot(x,y4,'rp');%绘制y4gridon;%添加网格%axis([min(x)max(x)min(y4)max(y4)]);%指定显示范围%%%%%%%%%%%%%%%%%%%%%%%%%%%%%画出一组二维图形%%%%%%%%%%%%%%%%%%%%%%%%%%%%%figure(2)a=linspace(0,2*pi,200);k=[1,2,3];y=sin(a')*k;plot(a,y(:,1),a,y(:,2),a,y(:,3));legend(['y=',num2str(k(1)),'*sin(x)'],['y=',num2str(k(2)),'*sin(x)']...,['y=',num2str(k(3)),'*sin(x)']);xlabel('x');ylabel('y');title('多条曲线绘制');gridon;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%画出一组三维图形%%%%%%%%%%%%%%%%%%%%%%%%%%%%figure(3)kk=30;x=linspace(-5,5,kk);y=linspace(-5,5,kk);fori=1:kkforj=1:kkz(i,j)=sin(x(i))+cos(y(j));endendsurf(x,y,z);xlabel('x');ylabel('y');zlabel('z');title('z=sin^2(x)/(3*y-2)');%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%复数绘制%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%figure(4)clearkk=1:1:10;fori=1:10y(i)=sin(kk(i))+cos(kk(i))/kk(i)*j;endcompass(y);五、褶积的相关计算与编程(设计2)1.设计内容:计算普通褶积与循环褶积,分别使用时间域与频率域两种方法进行正、反演计算,指出循环褶积计算时所存在的边界效应现象;编写一个做相关分析的源程序。2.实验成果:(1)、构造如下两个向量:a=[1,2,3,4];b=[9,8,7,6];计算得到:线性褶积[9265080654624]循环次数时间域频率域循环褶积5[5550508065][5550508065]6[332650806546][332650806546]7[9265080654624][9265080654624]8[92650806546240][92650806546240]从计算结果可以看出,当循环次数小于N1+N2-1时,线性褶积和循环褶积不等,当循环次数大于等于N1+N2-1时,线性褶积和循环褶积相等。(2)、构造两个向量:a=[123];b=[1235];计算相关得到:频率域:[14131623]时间域(6次):[148351323]程序:1、褶积%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%计算普通褶积与循环褶积,分别使用时间域与频率域两种方法%进行正、反演计算,指出循环褶积计算时所存在的边界效应现象;%编写一个做相关分析的源程序。%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%验证循环褶积和线性褶积在什么条件下相等%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clc;clear;a=[1,2,3,4];%a矩阵b=[9,8,7,6];%b矩阵%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%kk1=length(a);kk2=length(b);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%循环褶积时间域%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%xx=8;%循环次数手动更改aa=zeros(xx,1);aa(1:kk1,1)=a';%扩展abb=zeros(xx,1);bb(1:kk2,1)=b';%扩展bbb1=zeros(xx,xx);%循环矩阵fori=1:xxbb1(i:xx,i)=bb(1:xx-i+1);bb1(1:i-1,i)=bb(xx-i+2:xx);endok1=bb1*aa;%循环褶积结果%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%线性褶积时间域%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%bb2=zeros(kk1+kk2-1,kk1);fori=1:kk1bb2(i:i+kk2-1,i)=b(1:kk2)';endan=a';ok2=bb2*an;%线性褶积结果%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%循环褶积频率域%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%af=fft(aa);bf=fft(bb);ok3=ifft(af.*bf);2、相关%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%计算普通褶积与循环褶积,分别使用时间域与频率域两种方法进行%正、反演计算,指出循环褶积计算时所存在的边界效应现象;%编写一个做相关分析的源程序。%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%求两个一维数组的相关系数%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear;clc;a=[123];%数组a较短时可以手动输入b=[1235];%数组b较短时可以手动输入%a=csvread('**.csv',0,0);%数组a较长时可以读取csv文件%b=
本文标题:基于Matlab的数字信号处理课程设计课程报告
链接地址:https://www.777doc.com/doc-3876257 .html