matlab实习报告

实习报告
实习名称:模拟信号的数字化
专业班级:通信11-1、2 第28 组小组成员:1、学号:
2、学号:
指导老师:
实习时间:2014 年6 月2日至2014 年6 月20日
一. 工作原理
模拟信号的数字传输是指把模拟信号先变换为数字信号后,再进行传输。

由于与模拟传输相比,数字传输有着众多优点,因而此技术越来越受到重视。

此变化成为A/D 变换。

A/D 变换是把模拟基带信号变换喂数字基带信号,尽管后者的带宽会比前者大得很多,但本质上仍属于基带信号。

这种传输可直接采用基带传输,或经过熟悉调制后再做频带传输。

A/D 变化包括抽样、量化、编码三个步骤,如图。

二. 图1-1模拟信号数字化流程图
图中,抽样完成时间离散量化过程,所得m (KTs )为PAM 信号;量化完成复制离散化过程,所得mq(kTs)为多电平PAM 信号;编码完成多进制到二进制的变化过程,所得s(t)是二进制编码信号。

抽样
所谓抽样,就是对模拟信号进行周期性扫描,把时间上连续的信号变成时间上离散的信号,该模拟信号经过抽样后还应当包含原信号中所有信息,也就是说能无失真的恢复原模拟信号。

抽样的抽样速率下限是由抽样定理确定的。

抽样包括两种情况:低通型连续信号抽样、带通型连续信号抽样。

量化
所谓量化,就是把经过抽样的得到的瞬时值将其幅度离散,即用一组规定的点评,把瞬时抽样值用最接近的电平值来表示。

模拟信号进行平顶抽样后,其抽样值还是随信号幅度连续变化的。

当这些连续变化的抽样值通过噪声信道传输是,接收端不能准确地估值所发送的抽样。

如果发送端用鱼线规定的有限个电平来表示抽样值,且电平间隔比干扰噪声大,则接受端将有可能准确地估值所发送的抽样。

因此,有可能消除随机噪声的影响。

由于量化在连续抽样值和量化值之间产生误差,称为量化误差。

模拟信号的量化可以采用两种方式:均匀量化和非均匀
量化。

脉冲编码调制(PCM)
若信源输出的是模拟信号,如电话机传送的事语音信号等,要使其在数字信道中传输,必须在发送端将模拟信号转换成数字信号,即进行A/D变换,在接收端要进行D/A。

对语音信号最典型的数字编码就是脉冲编码调制(PCM)。

所谓脉冲编码调制:就是将模拟信号的抽样量化值转换成二进制码组的过程。

脉冲编码调制(PCM)原理:
PCM系统的原理方框图如下图所示,同种,输入的模拟信号m(t)经抽样、量化、编码后变换成数字信号,经心道传送到接收端的译码器,由译码器还原出抽样值,再经过低通滤波器滤出模拟信号。

其中,量化与编码的组合成为A/D 变换器;而译码与低通滤波的组合成为D/A变换。

图1-10 PCM通信系统方框图
三.模型建立
PCM编码器电路设计
PCM解码器设计
有干扰信号的PCM编码与解码
四.仿真环境
仿真程序
clear all;
close all;
%建立原信号
T=0.002; %取时间间隔为0.01
t=-0.1:T:0.1; %时域间隔dt为间隔从0到10画图
xt=cos(2*pi*30*t)+sin(2*pi*65*t);
%采样:时间连续信号变为时间离散模拟信号
fs=500; %抽样fs>=2fc,每秒钟内的抽样点数目将大于或等于2fc个
sdt=1/fs; %频域采样间隔0.002
t1=-0.1:sdt:0.1; %以sdt为间隔从-0.1到0.1画图st=cos(2*pi*30*t)+sin(2*pi*65*t); %离散的抽样函数
figure(1);
subplot(3,1,1);
plot(t,xt);
title('原始信号'); %画原始信号图
grid on
subplot(3,1,2);
stem(t1,st,'.'); %画出抽样后的离散图
title('抽样信号');
%量化过程
n=length(st); % 取st长度为n
M=max(st);
A=(st/M)*2048; %a1(极性码)a2a3a4(段落码)a5a6a7a8(段内电平码)
for i=1:n
if A(i)>=0
code(i,1)=1; %代表正值
else
code(i,1)=0; %代表负值
end
%这里就是量化的过程,划分成几个不等的段,然后用码元代替,也就是俗称编码
if abs(A(i))>=0&&abs(A(i))<16
code(i,2)=0;code(i,3)=0;code(i,4)=0;step=1;start=0;
elseif 16<=abs(A(i))&&abs(A(i))<32
code(i,2)=0;code(i,3)=0;code(i,4)=1;step=1;start=16;
elseif 32<=abs(A(i))&&abs(A(i))<64
code(i,2)=0;code(i,3)=1;code(i,4)=0;step=2;start=32;
elseif 64<=abs(A(i))&&abs(A(i))<128
code(i,2)=0;code(i,3)=1;code(i,4)=1;step=4;start=64;
elseif 128<=abs(A(i))&&abs(A(i))<256
code(i,2)=1;code(i,3)=0;code(i,4)=0;step=8;start=128;
elseif 256<=abs(A(i))&&abs(A(i))<512
code(i,2)=1;code(i,3)=0;code(i,4)=1;step=16;start=256; elseif 512<=abs(A(i))&&abs(A(i))<1024
code(i,2)=1;code(i,3)=1;code(i,4)=0;step=32;start=512; elseif 1024<=abs(A(i))&&abs(A(i))<2048
code(i,2)=1;code(i,3)=1;code(i,4)=1;step=64;start=1024;
end
B=floor((abs(A(i))-start)/step); %段内码编码floor(四舍五入)
t=dec2bin(B,4)-48 %dec2bin定义将B变为4位2进制码,-48改变格式
code(i,5:8)=t(1:4); %输出段内码
end
code=reshape(code',1,8*n); %reshape代表从新塑形
code
subplot(3,1,3);
stem(code,'.');axis([1 64 0 1]); %这里我们先取前面八个点编码输出,输出时候有64个点
title('编码信号');
五. 性能分析
仿真结果
-0.1
-0.08-0.06-0.04-0.0200.020.040.060.080.1-20
2
原始信号
抽样信号编码信号
六. 心得体会
通过这次课程设计,使我掌握了有关模拟信号数字化PCM 编码设计方面的知识,在设计过程中虽然遇到了一些问题,但经过一次又一次的思考,一遍又一遍的检查终于找出了原因所在,也暴露出了前期我们在这方面知识的欠缺和经验的不足。

在课程设计刚开始的时候,由于对MATLAB 的使用不太熟悉觉得无从下手使课程设计进展困难。

为此,我借助网络、图书等资源一步一步熟悉MATLAB ,并在熟练的同学的帮助下,渐渐摸索找到了方法。

我认识到在以后的学习过程中
要时刻保持着刻苦钻研的精神和坚持不懈的毅力。

本此课程设计的成功离不开自己的努力,离不开同学的帮助,更离不开知道老师的教育。

老师一方面在理论课上很详细很专业的为我们讲解了本次课程设计的理论知识,让我对此有了宏观上了解并能够掌握这些理论知识,为以后的实际操作提供了坚实的基础。

另一方面在实际操作时也给我们很多技术上的指导让我们能在此过程中学到更多的操作技能。

总的来说,这次的课程设计让我受益匪浅。

不仅是我体验到了动手操作的乐趣,而且培养了我的设计思维和增加了实践能力。

合集下载

Matlab实训报告

Matlab实训报告

Matlab实训报告Matlab实训报告MATLAB学院:班级:学号:姓名:实训报告评分栏:一、“帮助(Help)”文档部分内容翻译。

轴的控制Axis命令可以规定图象的缩放比例、方位、和纵横比,你可以交互的使用指令进行操作,详见图形的编辑。

设置轴的范围默认时,MATLAB可以根据数值的最大值和最小值决定合适的范围,用axis命令可以自己定义数值的标尺范围:axis([xminxmaxyminymax])三维图则用:axis([xminxmaxyminymaxzminzmax])用命令axisauto使MATLAB重新自动选择范围。

设定纵横比用axis也可以指定预先确定的数。

例如,axissquare使x轴和y轴等长。

axisequal使x轴与y轴的单位长度相等。

也就是说plot(exp(i*[0:pi/10:2*pi]))无论后面跟着axissquare还是axisequal都把椭圆变成正圆。

axisautonormal返回默认模式中定义的缩放比例。

设定轴的可见性用axis命令还可以使轴隐藏或显示。

axison使轴显示出来。

这是默认情况。

axisoff使轴隐藏。

设置网格线grid命令设置网格线显示或隐藏。

语句gridon使网格线显示,gridoff隐藏网格线。

图形的打印你能直接在一台已连接到你的计算机上的打印机上打印一个MATLAB图形,或输出图形到一种MATLAB所支持的图象文件格式。

这里提供两种打印或输出图形的方法。

在File菜单下用Print选项用print命令从菜单打印在File菜单下方有四个菜单选择是关于打印的。

PageSetup选项显示一个对话框,它使你能调整打印页图形的特征。

PrintSetup选项显示一个对话框,它设置打印默认值,但是实际上不打印图形。

PrintPreview选项使你能查看到打印出来页面的样子。

Print选项显示一个对话框,它让你选择标准打印选项然后打印图形。

通常,使用PrintPreview确定打印的输出是否你想要的效果。

matlab实训心得体会(通用23篇)

matlab实训心得体会(通用23篇)

matlab实训心得体会(通用23篇)matlab实训篇1自己刚刚接触matlab有半个学期的时间,说实话我现在对MATLAB还是摸不着头脑,一方面是自己接触的时间太短,另一方面,就是自己在上机方面投入的时间有限,实践比较少。

现在,我对MATLAB的印象仅仅在解决习题和绘制图形上,但是我很喜欢MATLAB的简单的语法,易于绘制图形,编程也非常容易, 并且具有功能强大的开放式的toolbox。

因此,尽管我一直没有这方面的应用,但是我还是对它非常感兴趣,自己正打算暑假好好研究研究MATLAB。

下面是我学习MATLAB在理论和实践方面的一点心得与体会,可能有些地方自己理解的不是很正确,但是随着学习的深入,我想我可以发现自己的错误所在。

首先我想说的是,在理论方面,在学习MATLAB过程中,我感觉到它和c语言有许多相似之处,他有c语言的特征,但是比c语言编程计算更加简单,适合于复杂的数学运算。

但是MATLAB跟其他语言也有着很大的不同。

现在用的比较多的编程语言,除了MATLAB就应该是c、c++、VHDL,VB和Delphi也接触过,如果自己抱着“把其他语言的思想运用在MATLAB里面”的话,那么我想,即使程序运行不出错,也很难把握MATLAB的精髓,也就很难发挥MATLAB的作用了。

众所周知MATLAB是一个基于矩阵运算的软件,但是,真正在运用的时候,特别是在编程的时候,许多人往往没有注意到这个问题。

在使用MATLAB时,受到了其他编程习惯的影响,特别是经常使用的C语言。

因此,在MATLAB编程时,for循环(包括while循环)到处都是。

.这不仅是没有发挥MATLAB所长,还浪费了宝贵的时间。

我这里想说的一点是,往往在初始化矩阵的时候注意到这个问题,懂得了使用矩阵而不是循环来赋值,但是,在其他环节上,就很容易疏忽,或者说,仍然没有摆脱C++、C的思想。

MATLAB博大精深,涉及的内容很多,所以,我认为不要试图掌握MATLAB的每一个功能,熟悉和你专业最相关的部分就可以了,这也是老师在课堂上经常说的。

matlab_实习报告

matlab_实习报告

matlab_实习报告在大学的学习生涯中,实习是一个非常重要的环节,它能够让我们将理论知识与实际应用相结合,提升自己的专业技能和综合素质。

本次实习,我选择了使用 MATLAB 这个强大的工具进行实践操作,通过一段时间的学习和实践,我收获颇丰。

一、实习目的本次实习的主要目的是深入了解和掌握MATLAB 软件的使用方法,能够运用其解决实际问题,并提高自己的编程能力和逻辑思维能力。

同时,通过实际项目的操作,培养自己的团队协作精神和解决问题的能力,为今后的学习和工作打下坚实的基础。

二、实习单位及岗位介绍我实习的单位是_____,在实习期间,我主要负责利用 MATLAB 进行数据分析和算法实现的相关工作。

三、实习内容及过程(一)基础学习在实习的初期,我首先对 MATLAB 的基本语法和操作进行了系统的学习。

了解了变量的定义、数据类型、矩阵运算、函数的编写等基础知识。

通过大量的练习和实例,我逐渐熟悉了 MATLAB 的编程环境,能够熟练地编写简单的程序。

例如,在学习矩阵运算时,我通过编写程序实现了矩阵的加法、乘法、求逆等操作,深刻理解了矩阵运算在数学和工程中的重要应用。

(二)项目实践在掌握了基础知识后,我开始参与实际的项目。

其中一个项目是对一组数据进行分析和处理,以提取有用的信息。

首先,我使用MATLAB 读取数据文件,并对数据进行预处理,包括去除噪声、缺失值处理等。

然后,运用统计学方法对数据进行分析,计算均值、方差、相关性等统计量。

最后,通过绘图函数将分析结果以直观的图表形式展示出来,以便更好地理解数据的特征和趋势。

在这个过程中,我遇到了很多问题。

例如,数据的格式不一致导致读取错误,算法的复杂度过高导致运行时间过长等。

通过查阅资料、请教同事和不断地调试,我最终解决了这些问题,顺利完成了项目任务。

(三)算法实现除了数据分析,我还参与了算法的实现工作。

在一个图像识别的项目中,需要使用机器学习算法对图像进行分类。

matlab实践报告

matlab实践报告

竭诚为您提供优质文档/双击可除matlab实践报告篇一:matlab实习报告mATLAb实习报告姓名:吴涛专业:电子信息工程班级学号:信息(2)班20XX1605010230指导教师:宋艳霞钱云实习时间:20XX,5,13至20XX,5,17目录:一:实习目的 (3)二:实习任务...........................三:实习要求...........................四:实习目的...........................五:实习体会...........................一:实习目的熟悉matlab的软件环境熟悉matlab的基本使用方法二:实习任务1.掌握matlab语言的基本语法规则及基本操作命令的使用。

2.熟悉运用matlab的数组,矩阵运算,数学运算的运算方法。

3.熟悉matlab的字符串,单元数组。

4.熟悉matlab的程序设计。

5.熟悉matlab的符号计算功能。

6.熟悉matlab的绘图及句柄图形。

7.6熟悉matlab的guI设计。

三:实习要求1.每次上机要签到,记录。

2.做的题目要在上机结束后以电子版和woRD文档形式交给指定负责人。

3.认真做一份实习总结报告。

四:实习内容共六题第1题:求a和b的和。

代码:a=[1,2,3]b=[4,5,6]s=a+b结果:s=579第2题:求a和b的差。

代码:a=[4,5,6]b=[1,2(:matlab实践报告),3]h=a-b结果:h=333第3题:求下列方程组的解。

6x1+3x2+4x3=3-2x1+5x2+7x3=-48x2-4x2-3x3=-7代码:A=[6,3,4;-2,5,7;8,-4,-3] b=[3;-4;-7]a=A\b结果:a=0.60007.0000-5.4000第4题:用for语句求三角函数表。

代码:forx=0:0.1:pi/4disp([x,sin(x),cos(x),tan(x)]),en d结果:00100.10000.09980.99500.10030.20000.19870.98010.20270.30000.29550.95530.30930.40000.38940.92110.4228篇二:matlab课程实践报告mATLAb实践》课程设计学生姓名:林淑真学号:110900824专业班级:通信工程四班指导教师:郑晓明二○一二年六月十五日《目录1.设计目的.........................................................22.题目分析.........................................................23.总体设计.........................................................34.具体设计.........................................................35.结果分析.........................................................226.心得体会.........................................................237.参考书目.........................................................238.附录 (24)1、设计目的综合运用mATLAb工具箱实现图像处理的guI程序设计。

matlab实习总结.(大全5篇)

matlab实习总结.(大全5篇)

matlab实习总结.(大全5篇)第一篇:matlab实习总结.MATLAB和Mathematica、Maple并称为三大数学软件。

它在数学类科技应用软件中在数值计算方面首屈一指。

MATLAB可以进行矩阵运算、绘制函数和数据、实现算法、创建用户界面、连 matlab开发工作界面接其他编程语言的程序等,主要应用于工程计算、控制设计、信号处理与通讯、图像处理、信号检测、金融建模设计与分析等领域。

MATLAB的基本数据单位是矩阵,它的指令表达式与数学、工程中常用的形式十分相似,故用MATLAB来解算问题要比用C,FORTRAN等语言完成相同的事情简捷得多,并且MATLAB也吸收了像Maple等软件的优点,使MATLAB成为一个强大的数学软件。

在新的版本中也加入了对C,FORTRAN,C++,JAVA的支持。

可以直接调用,用户也可以将自己编写的实用程序导入到MATLAB函数库中方便自己以后调用,此外许多的MATLAB爱好者都编写了一些经典的程序,用户可以直接进行下载就可以用Matlab是一个强大的数学工具,它的应用广泛,涉及到各个领域.它使用起来十分方便,不用麻烦去定义变量.它的绘图能力很强,甚至可以模拟出三维视图.矩阵是它应用的核心,许多工程繁琐的运算都需要靠矩阵来化简,这正是它的生命力所在.但是,他的函数很多,开始学时记的比较痛苦,我已经深深感觉到了.不过看多了也就熟了,感觉和学五笔差不多.它的语法简单,像我学过C语言的学起来还是蛮容易的.它的数组定义十分符合自然,是从1开始的,数组元素的调用也很接近数学的表达.此外,函数的名字也很符合英文规则,反正我用得很开心就是了.通过学习matlab,我又一次锻炼了自己的思维.它学起来得心应手也让我明白了学习一门语言(c语言对学习其他语言的帮助指导作用.同时,它也加强了我理论联系实际的能力.这是一个专业课的基础工具,学好它是必要的.在第一章中,讲的是一些matlab的入门技术,除了一些基本操作与介绍之外,还初步认识了简单指令的编制,认识了一些matlab 的特殊符号,例如运算用到的加减乘除。

matlab实验报告

matlab实验报告
(1)信号形式 ,利用plot命令绘制该信号在 区间内,且采样间隔为 的曲线。添加网格线,标题为“正弦信号曲线”,横坐标显示“x”,纵坐标显示“y”。
(2)将上述信号左平移或右平移 得到两个新信号y2和y3,利用hold命令在同一图中显示三条曲线并通过线型和颜色加以区分。
(3)利用subplot命令将y,y2和y3以子图的形式显示。
3.
实验结果及分析
1.(1)
t1 =
0.0780
实验结果及分析
(2)
t2 =
0.0780
实验结果及分析
(3)
t3 =
0
实验结果及分析
2.
实验
名称
实验四Matlab在通信系统中的应用
实验目的
1、练习通信原理中各种调制方法及简单通信系统的Matlab编程实现;
2、学习Matlab与Simulink的混合编程。
(2)y变成虚数后,重复上述运算。
(3)创建矩阵 ,并进行如下操作,取出矩阵A的前两行元素,生成一个新矩阵B。生成一个3*3的单位矩阵B,与矩阵A进行加、减、乘、除、相等、不相等运算。
(4)随机生成2个复数x1和x2,计算x3=x1÷x2,x3的实部real_x3、虚部image_x3、模abs_x3、幅角angle_x3,并把x1,x2,x3,real_x3,image_x3,abs_x3,angle_x3保存至文件complex_学号.mat。利用save命令保存数据为mat格式文件后,用clear命令清除工作空间中的变量,再利用load命令从文件读入数据。
2、流程控制语句相关操作。
(1)使用for语句及while语句求解1至100整数中奇数的和。
(2)求连续自然数的和,当和大于等于1000时,求最后一个自然数以及自然数的和。

MATLAB_实习报告范文大全

MATLAB_实习报告范文大全第一篇:MATLAB_实习报告实习报告实习题目:专业:学号:的设计与绘图MATLAB 一.概述MATLAB 作为一种高级科学计算软件,是进行算法开发、数据可视化、数据分析以及数值计算的交互式应用开发环境。

世界上许许多多的科研工作者都在使用 MATLAB 产品来加快他们的科研进程,缩短数据分析和算法开发的时间,研发出更加先进的产品和技术。

二.实验目的1.进一步熟悉MATLAB的软件环境和基本使用方法;2.巩固运用MATLAB、矩阵运算、多项式运算、字符串、单元数组、符号计算功能、绘图及句柄图形及它们的命令语句;3.学习和巩固数字图形图像处理在MATLAB中的知识和运用;4.培养我们独立自学、设计和撰写实验报告的能力;5.通过对MATLAB的进一步学习,是我们加深所学内容的认识,理解,掌握,能把所学知识运用到实际工作中;三.实习日记1.熟悉MATLAB的软件环境和基本使用方法(第一周)MATLAB的语言的基本功能和特点:它是一种高级科学计算语言,相对于传统的C、C++ 或者FORTRAN 语言,MATLAB 提供了高效快速解决各种科学计算问题的方法。

它具有数学计算、开发工具、数据的可视化、交互式编辑创建图形、集成的算法开发编程语言和环境、图形用户界面开发环境——GUIDE、开放性、可扩展性强、专业应用工具箱等强大的功能。

具有易于学习、使用方便、支持多种操作系统、丰富的内部函数、强大的图形和符号功能等优点。

路径设置:除 MATLAB 默认的搜索路径外,用户可以设置搜索路径。

设置方法为:选择 MATLAB 窗口中的 File | Set Path 命令,进入路径搜索对话框。

MATLAB 的搜索顺序:当在命令窗口中或者一个 M 文件中输入一个元素名时,MATLAB 按照下面的顺序搜索该元素的意义,以元素foo 为例:1)查找工作区中是否存在名为 foo 的变量; 2)在当前路径中查找是否存在名 foo.m 的文件;3)按照顺序查找搜索路径中是否存在该文件。

MATLAB实验报告(8个实验)

MATLAB实验报告(8个实验)四川师范大学MATLAB语言实验报告1系级班年月日实验名称:Intro, Expressions, Commands姓名学号指导教师成绩1ObjectiveThe objective of this lab is to familiarize you with the MATLAB program development environment and to develop your first programs in this environment.2Using MATLAB2.1Starting MATLABLogon to your computer and start MATLAB by double-clicking on the icon on the desktop or by using the Start Programs menu. MATLAB Desktop window will appear on the screen.The desktop consists of several sub-windows. The most important ones are:●Command Window (on the right side of the Desktop) is used to do calculations,enter variables and run built-in and your own functions.●Workspace (on the upper left side) consists of the set of variables (arrays) createdduring the current MATLAB session and stored in memory.●Command History (on the lower left side) logs commands entered in theCommand Window. You can use this window to view previously run statements, and copy and execute selected statements.You can switch between the Launch Pad window and the Workspace window using the menu tabs under the sub-windowon the upper left side. Similarly, you can switch between the Command History and Current Directory windows using the menu tabs under the sub-window on the lower left side.2.2Executing CommandsYou can type MATLAB commands at the command prompt “>>” on the Command Window.For example, you can type the formula cos(π/6)2sin(3π/8) as >>(cos(pi/6) ^ 2) * (sin(3 * pi/8))Try this command. After you finish typing, press enter. The command will be interpreted and the result will be displayed on the Command Window.Try the following by observing how the Workspace window changes:>> a = 2; (M ake note of the us age of “;”)>> b = 3;>> c = a ^ 4 ? b ? 5 + pi ^3You can see the variables a, b and c with their types and sizes on the Workspacewindow, and can see the commands on the Command History window.Spend a few minutes to practice defining array variables (i.e. vectors and matrices)usingthe square bracket (“[ ]”) and colon (“:”) operators, and zeros() and ones() functions.>> ar =[ 1 2 3 4 5 ];>> br =[ 1 2 3 ;4 5 6 ];>> cr = [1 : 3 : 15];Set dr to ?rst 3 elements of ar.dr=ar(1:3);Set er to second row of br.er=br(2,:);Set ar to [dr er]. Find the number of elements of ar.ar=[dr er]; length(ar)2.3 Getting HelpThere are several ways to get help on commands and functions in MATLAB. First ofall you can use the Help menu. You can also use the “?” button. Try to findinformation on the plot function from the help index. Also try to get information onthe same function using the help command (i.e. type help plot). Finally, experimentwith the lookfor command. This command looks for other commands related to agiven keyword.2.4 Some Useful CommandsTry the following commands and observe their results:Which : Version and location infoClear : Clears the workspaceClc : Clears the command windowwho, whos : Lists content of the workspace3 ExercisesPlease solve the following problems in MATLAB. Do not forget to keep a diary ofyour commands and their outputs.(1) De?ne the variables x y and z as 7.6, 5.5 and 8.1, respective ly, and evaluate:578.422.52??? ??-x y xz(2) Compute the slope of the line that passes through thepoints (1,-2) and(5,8).(3) Quiz 1.1: 5(4)1.6 Exercises: 1.1, 1.4(5)2.15 Exercises: 2.6, 2.9, 2.114Quitting MATLABTyping quit on the command window will close the program. Do not forget to send your diary file and M-file to your TA.Do not forget to delete your ?les from the hard disk of the PC you used in the lab at the end of the lab session.四川师范大学MATLAB语言实验报告2系级班年月日实验名称:Programming, Relational and Logical Expressions 姓名学号指导教师成绩1ObjectiveThe objective of this lab is to familiarize you with the MATLAB script files (M-files), subarrays, relational and logical operators.2Script FilesScript files are collections of MATLAB statements that are stored in a file. Instead of typing commands directly in the Command Window, a series of commands may be placed into a file and the entire file may be executed by typing its name in the Command Window. Such files are called script files that are also known as M-files because they have an extension of .m. When a script file is executed, the result is the same as it would be if all of the commands had been typed directly into the Command Window. All commands and script files executed in the Command Window share a common workspace, so they can all share variables in the workspace. Note that if two script files are executed successively, the second script file can use the variables created by the first script file. In this way, script files can communicate with other script files through the data left behindin the workspace. An Edit Window is used to create new M-files or to modify existing ones. The Edit Window is a programming text editor, with the features of MATLAB language highlighted in different colors. You can create a new M-file with the File/New/M-file selection and you can open an existing M-file with the File/Open selection from the desktop menu of MATLAB.(1)Create a new working directory under the current directory and change the currentdirectory to …TA?s suggest?.3SubarraysIt is possible to select and use subsets of MATLAB arrays. To select a subset of an array, just include a list of the elements to be selected in the parentheses after the array name. MATLAB has a special function named end that is used to create arraysubscripts. The end function always returns the highest value taken on by a givensubscript. It is also possible to use subarrays on the left-hand side of an assignmentstatement to change only some of the values in an array. If values are assigned to asubarray, only those values are changed but if values are assigned to an array, theentire contents of the array are replaced by the new values.(1) Define the following 5 x 5 array arr1 in MATLAB.----=2274235421209518171651413215111012844563311arr(2) Write a MATLAB statement to select a subset of arr1 and return the subarraycontaining the values as shown.=22745456311arrarr11=arr1([1,5],[2 4 5]);(3) Write two MATLAB statements to select the last row and last column of arr1,separately.arr12=arr1(5,:);或arr12=arr1(end,:); arr13=arr1(:,end);或arr13=arr1(:,5);(4) Write MATLAB statements to obtain the following array from arr1.-=2257462335432112arrarr2=arr1([1 5],:)';4 Relational and Logical OperatorsRelational and logical operators are the two types of operators that produce true/falseresults in MATLAB programs. MATLAB interprets a zero value as false and anynonzero value as true. Relational operators ( ==, =,>,>=,<,<=) are operators with twooperands that produce either a true (1) or a false (0) result, depending on the values ofthe operands. Relational operators can be used to compare a scalar value with an array.They can also be used to compare two arrays or two strings only if they have the samesize. Be careful not to confuse the equivalence relational operator ( == ) with theassignment operator ( = ). Logic operators ( &, |, xor, ~ ) are operators with one ortwo operands that yield a logical result such as 0 or 1. There are three binary logicoperators: AND (& ), OR ( |), and exclusive OR ( xor ); and oneunary operator: NOT( ~). In the hierarchy of operations, logic operators are evaluated after allarithmetic and relational operators have been evaluated. The operator is evaluatedbefore other logic operators.(1) Define the following 4 x 5 array arr4 in MATLAB.------=212343212343212543214arr(2) Write an expression using arr4 and a relational operator to produce the followingresult.=110001110011110111115arrarr5=arr4>0;(3) Write an expression using arr4 and a relational operator to produce the followingresult.=010000010000010000016arrarr6=arr4==1;(4) Write a MATLAB program which will generate an (n-1)x(n-1) matrix from agiven nxn matrix which will be equal to given matrix with first row and firstcolumn deleted.arr44=rand(5); arr444=arr35(2:end,2:end);(5) Generalize your program above so that the program should ask the row andcolumn numbers to be deleted and then generate new (n-1)x(n-1) matrix.n=input('input n:');matrixn=rand(n)delrow=input('input row numbers to be deleted:');delcolumn=input('input column numbers to be deleted:');matrixn_1=matrixn([1:delrow-1 delrow+1:end], [1:delcolumn-1 delcolumn+1:end])(6) Quiz 3.1 (P88)5 Quitting MATLABTyping quit on the command window will close the program. Do not forget to sendyour diary file and M-file to your TA.Do not forget to delete your files from the hard disk of the PC you used in the lab atthe end of the lab session.四川师范大学MATLAB 语言实验报告3系级班年月日实验名称:Branches and Loops, Logical Arrays.姓名学号指导教师成绩 1 ObjectiveThe objective of this lab is to familiarize you with the MATLAB Branches and Loops,Logical Arrays.2 ExercisesDo not forget to add sufficient documentation and proper indentation to all programsyou write.(1) Write a program that calculates follow equation with for and while loop, and writea program without loop.63263022212+++==∑= i i K% for loopk1=0;for ii=1:64k1=k1+2^(ii-1);end% while loopk2=0;n=0;while n>=0&n<64k2=k2+2^n;n=n+1;end% without loopa=0:63;b=2.^a;K3=sum(b);(2) Write a program that accepts a vector of integers as input and counts the numberof integers that are multiples of 3 in that vector. You can assume that the inputcontains only integer values. An example run of your program can be as follows:Enter a vector of integers: [ 1 3 2 8 0 5 6 ]The number of multiples of 3 is 2(3) The root mean square is a way for calculating a mean fora set of numbers. The rmsaverage of a series of numbers is given as:∑==N i i xN rmsaverage 121Write a program that will accept an arbitrary number of input values and calculatethe rmsaverage of the numbers. The program should ask the user for the numberof values to be entered. Test your program with 4 and 10 set of numbers.% The root mean square is a way for calculating a mean for a set of numbers% Initializesum_x2=0;% Get the number of points to input.n=input('Enter number of points:');% Loop to read input valuesfor ii=1:n% Read in next valuex=input('Enter value:');% Calculate square sumssum_x2=sum_x2+x^2;end% Now calculate root mean squareroot_ms=sqrt(sum_x2/n);% Tell userfprintf('The number of data points is: %d\n',n);fprintf('The root mean square of this data set is: %f\n',root_ms);(4) 3.8 exercises:3.5(5) 4.7Exercises: 4.1 4.23 Quitting MATLABTyping quit on the command window will close the program. Do not forget to sendyour M-file to your TA.Do not forget to delete your files from the hard disk of the PC you used in the lab at the end of the lab session.四川师范大学MATLAB语言实验报告4系级班年月日实验名称:MATLAB/SIMULINK package姓名学号指导教师成绩1Objective●To learn how to use MATLAB/SIMULINK package●To learn how to estimate performance parameters from time-domain data2SIMULINK BasicBasic steps(1)Click on the MATLAB button to start MATLAB.(2)Once MATLAB has started up, type simulink (SMALL LETTERS!) at theMATLAB prompt (>>) followed by a carriage return (press the return key). A SIMULINK window should appear shortly, with the following icons: Sources, Sinks, Discrete, Linear, Connections, Extras.(3)Next, go to the File menu in SIMULINK window and choose New in order tobegin building the block diagram representation of the system of interest.(4)Open one or more of the block libraries and drag the chosen blocks into the active.(5)After the blocks are placed, draw lines to connect their input and output ports bymoving the mouse over a port and drag using the left button. To make a line witha right angle in it, release the button where you want thecorner, then click on theend of the line and drag to create next segment. To add a second line that runs off of an existing line click the right mouse on an existing line and drag it.(6)Save the system by selecting Save from the File menu.(7)Open the blocks by double-clicking and change some of their internal parameters.(8)Adjust some simulation parameters by selecting Parameters from the Simulationmenu. The most common parameter to change is Stop Time that defines the length of time the simulation will run.(9)Run the simulation by selecting Start from the Simulation menu. You can stop asimulation before completing by selecting Stop from the Simulation menu. (10)View the behavior of the system by attaching Scope blocks to the variables ofinterest, or by using To Workspace blocks to send data to the MATLAB workspace where you can plot the results using standard MATLAB commands.3Exercises(1)Your TA has shown you how to observe and print signals from the scope. Try thisout by printing out the input signal, which should be a -1V to 1V square wave with frequency 0.1 Hz. Note the peak-to-peak voltage difference of this signal.Note to write key blocks parameters.(2) Write a Simulink model to calculate the following differential equation,0)1(222=+--x dt dx x dt x d μInitialized 1)0(=x ,0)0(=dt dx 。

MATLAB综合性实验报告8

一、实验目的:1.学会运用Matlab解决实际问题2.进一步掌握Matlab的一些基本操作3.通过范例体会Matlab的初步建模过程4学会用做动画二.实验仪器、设备或软件:电脑、MATLAB软件三.实验内容:1.已知前两年的猪肉的产量和猪肉的价格分别为:39吨,28吨,12元/公斤,17元/公斤,根据前一年的猪肉价格影响后一年猪肉产量当年猪肉产量影响当年猪肉价格的线性关系,编写程序,利用动画原理画出前十年猪肉的产量——价格的动态图形。

(参数设置为,c1=39,c2=28,c3=36,r1=12,r2=17,k=16)。

2.在地面上建有一座圆柱形水塔,水塔内部的直径为d,并且在地面处开了一个高为H的小门.现在要对水塔内部进行维修施工,施工方案要求把一根长为l(l>d)的水管运到水塔内部.请问水塔的门高H多高时,才有可能成功地把水管搬进水塔内。

四.实验记录:1.蛛网模型:实验代码:clear%c1为产量1, c2为产量2, c3为产量3, r1为%肉价1, r2为肉价2, k为K年后产量与肉价%是否稳定c1=39;c2=28;c3=36;hold offr1=12;r2=17;k=16;a1=[c1 1;c2 1];%系数矩阵b1=[r1,r2]';%列向量a2=[r1 1;r2 1];b2=[c2,c3]';a=a1\b1;b=a2\b2;%x0(1)=c1;for n=1:30y0(n)=a(1)*x0(n)+a(2); %a(1)a(2)为矩阵元素的引用,下行类似x0(n+1)=b(1)*y0(n)+b(2);x(n)=x0(n);y(n)=x0(n+1);endplot(x,y0,'-g',y,y0,'-b')hold onm=moviein(100);for n=1:kfor j=1:30t1=x0(n)+(j-1)*(x0(n+1)-x0(n))/30;t2=x0(n)+j*(x0(n+1)-x0(n))/30;if t2<t1t=t1;t1=t2;t2=t;%这样做方便画图elseendt=t1:0.01:t2;plot(t,y0(n),'.r')%划横线t1=y0(n)+(j-1)*(y0(n+1)-y0(n))/30;t2=y0(n)+j*(y0(n+1)-y0(n))/30;if t2<t1t=t1;t1=t2;t2=t;elseendt=t1:0.01:t2;plot(x(n+1),t,'.r')%划竖线endm(:,n)=getframe;endmovie(m,20)实验结果:ans =Columns 1 through 639.0000 28.0000 36.0000 30.1818 34.4132 31.3358 Columns 7 through 1233.5739 31.9462 33.1300 32.2691 32.8952 32.4398 Columns 13 through 1832.7710 32.5302 32.7053 32.5779 32.6706 32.6032 Columns 19 through 2432.6522 32.6166 32.6425 32.6236 32.6374 32.6274 Columns 25 through 3032.6346 32.6294 32.6332 32.6304 32.6324 32.6310 Column 3132.6320实验图像:2.水塔模型:实验代码:Clearfunction x=lt523(l,d,h) k1=0;a=0l=7;d=3ymax=0;k2=0;b=pi/2;h=3;while (b-a)>10^(-2)k2=k2+1;m=0;a=0;if k1==0n=ceil(b/h)-1 elsen=ceil(b/h);endfor i=1:n+1;x(i)=a+(i-1)*(b-a)/n;y(i)=l*sin(x(i))-d*tan(x(i));endfor i=1:nif y(i)>ymaxymax=y(i);a=x(i-1);else y(i)<ymaxb=x(i);endendm=m+1;k1=k1+1;h=(b-a)/5;endabx=(a+b)/2t=0:0.01:1.35y1=l*sin(t)-d*tan(t);plot(t,y1,'-b')方法:2syms h xh=8*sin(x)-2*tan(x);d1=0;d2=pi/2;d0=(d1+d2)/2;d=0.03;a=subs(h,x,d1);b=subs(h,x,d2);c=subs(h,x,d0);for n=d1:d:d2if (((c-a)/(d0-d1))*((b-c)/(d2-d0)))<0 d1=d1+d; d2=d2-d; d0=(d1+d2)/2;a=subs(h,x,d1);b=subs(h,x,d2);c=subs(h,x,d0);endendd0hold onaxis([0,pi/2,-5,5])x=0:0.05:pi/2;plot(x,8*sin(x)-2*tan(x),'-b')实验运行结果:五、实验总结:通过做此实验,让我对MATLAB有更进一步的了解,学会怎样才能正确运用MATLAB求解实际问题,了解如何利用数学模型去解释和分析社会经济问题,特别是这个典型经济问题的求解。

matlab实验心得总结(5篇范例)

matlab实验心得总结(5篇范例)第一篇:matlab实验心得总结通过《matlab仿真》实验使我学习掌握了许多知识。

首先是对matlab有了一个全新的认识,其次是对matlab的更多操作和命令的使用有了更高的掌握,最重要的事对matlab的处理能力有了一个更高的飞跃尤其是对相关函数的使用及相关问题的处理。

就对matlab相关的命令操作而言,通过这次实验的亲身操作和实践,学习掌握了许多原本不知道的或者不太熟悉的命令。

比如说相关m文件的建立,画图用到的标注,配色,坐标控制,同一张图里画几幅不同的图像,相关参数的设置以及相关函数的调用格式等等。

就拿建立一个数学方程而言,通过设置不同的参数达到所需要的要求和结果,而且还可以在不同的窗口建立不同的函数而达到相同的效果,比如说可以再命令窗口和m文件中通过不同的命令设置的到相同的所需的效果图。

而自己对于矩阵及闭环传递函数的建立原本所掌握的知识几乎为零,而通过这次实验使我彻底的掌握了相关的命令操作和处理的方法,在这里我们不仅可以通过建立函数和参数来达到目标效果,而且还可以通过可视化的编程达到更快更方便,更简洁的效果。

就拿可视化编程而言原本根本就只是听说而已罢了,从来就没有亲身去尝试过,然而现在自己却可以和容易的通过搭建不同功能木块来实现相关的函数及功能。

这些在原本根本就不敢相信,然而通过《matlab仿真》的学习和实验亲身操作这些原本看似不可能的操作在此就变的轻而易举的事了。

再此我不得不题到的事指导老师教我们怎么去搭建构造相关闭环传递函数的实验,这个实验几乎在我们的这次实验中占据了非常大的比重,在后面的几个大一点的实验中几乎都是涉及这个方面的内容,我现在想说的事怎么去搭建相关的函数和功能模块对我们来说几乎已经不是什么难事了,就拿怎么去对模块功能的实现以及分析确实是个重点和难点。

通过对同一个模块分析其对应的不同的参数分析图的建立去分析和解释其对应的相关功能和技术指标和性能分析是非常重要的,我们不可能只需要建立相关的模块和功能就说自己掌握了所有的相关知识和技术,真正的技术和知识是怎么去分析和解释相关的技术指标和功能参数才是重中之重。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档