MATLAB_实习报告
MATLAB实验报告

MATLAB实验报告一、实验目的本次 MATLAB 实验旨在深入了解和掌握 MATLAB 软件的基本操作和应用,通过实际编程和数据处理,提高解决问题的能力,培养编程思维和逻辑分析能力。
二、实验环境本次实验使用的是 MATLAB R2020a 版本,运行在 Windows 10 操作系统上。
计算机配置为英特尔酷睿 i5 处理器,8GB 内存。
三、实验内容(一)矩阵运算1、矩阵的创建使用直接输入、函数生成和从外部文件导入等方式创建矩阵。
例如,通过`1 2 3; 4 5 6; 7 8 9` 直接输入创建一个 3 行 3 列的矩阵;使用`ones(3,3)`函数创建一个 3 行 3 列元素全为 1 的矩阵。
2、矩阵的基本运算包括矩阵的加减乘除、求逆、转置等。
例如,对于两个相同维度的矩阵`A` 和`B` ,可以进行加法运算`C = A + B` 。
3、矩阵的特征值和特征向量计算通过`eig` 函数计算矩阵的特征值和特征向量,加深对线性代数知识的理解和应用。
(二)函数编写1、自定义函数使用`function` 关键字定义自己的函数,例如编写一个计算两个数之和的函数`function s = add(a,b) s = a + b; end` 。
2、函数的调用在主程序中调用自定义函数,并传递参数进行计算。
3、函数的参数传递了解值传递和引用传递的区别,以及如何根据实际需求选择合适的参数传递方式。
(三)绘图功能1、二维图形绘制使用`plot` 函数绘制简单的折线图、曲线等,如`x = 0:01:2pi; y = sin(x); plot(x,y)`绘制正弦曲线。
2、图形的修饰通过设置坐标轴范围、标题、标签、线条颜色和样式等属性,使图形更加清晰和美观。
3、三维图形绘制尝试使用`mesh` 、`surf` 等函数绘制三维图形,如绘制一个球面`x,y,z = sphere(50); surf(x,y,z)`。
(四)数据处理与分析1、数据的读取和写入使用`load` 和`save` 函数从外部文件读取数据和将数据保存到文件中。
4)MATLAB实验报告

4)MATLAB实验报告MATLAB实验报告一、引言MATLAB是一种强大的数学软件,广泛应用于科学研究、工程设计和数据分析等领域。
本实验报告旨在介绍使用MATLAB进行数据处理和可视化的基本方法,并通过实例展示其应用。
二、数据处理1. 数据导入与读取在MATLAB中,可以使用load函数或importdata函数导入外部数据文件。
load函数适用于导入MATLAB格式的数据文件,而importdata函数可以导入多种格式的数据文件,如文本文件、Excel文件等。
2. 数据清洗与转换数据清洗是指对原始数据进行去除异常值、缺失值填充等处理,以保证数据的准确性和完整性。
MATLAB提供了丰富的函数和工具箱,如统计工具箱、优化工具箱等,可以方便地进行数据清洗和转换操作。
3. 数据分析与建模MATLAB具有强大的数学和统计分析功能,可以进行数据的描述性统计、回归分析、时间序列分析等。
通过使用相关函数和工具箱,可以对数据进行深入分析,并建立相应的数学模型。
三、数据可视化1. 统计图表MATLAB提供了丰富的绘图函数和工具箱,可以绘制各种统计图表,如直方图、散点图、箱线图等。
这些图表可以直观地展示数据的分布、关系和趋势,有助于更好地理解和解释数据。
2. 三维可视化除了二维图表外,MATLAB还支持三维数据的可视化。
通过使用plot3函数、mesh函数等,可以将三维数据以曲线、曲面等形式展示出来,进一步提供对数据的深入理解。
3. 动态可视化MATLAB还支持动态可视化,即通过动画或交互式图形来展示数据的变化过程。
通过使用animate函数、interactiveplot函数等,可以将数据的变化以动态的方式展示出来,增加数据分析和呈现的趣味性。
四、实例应用以某电商平台销售数据为例,展示如何使用MATLAB进行数据处理和可视化。
首先,导入销售数据文件,清洗数据,去除异常值和缺失值。
然后,通过统计分析,计算销售额、销量、平均价格等指标,并绘制相应的统计图表。
基于matlab的实验报告

基于matlab的实验报告实验报告:基于MATLAB 的实验一、实验目的通过使用MATLAB 软件,掌握如何进行数据分析、图像处理、算法实现等一系列实验操作,提高实验者的实践能力和动手能力。
二、实验原理MATLAB 是一种在科学计算和技术开发领域广泛应用的计算机软件。
它能进行矩阵计算、绘制函数和数据图像、实现算法以及进行数据分析等。
通过掌握MATLAB 的使用,能够快速、高效地解决各种科学和工程问题。
三、实验内容1. 数据分析:使用MATLAB 的数据分析工具进行数据的导入、处理和分析。
2. 图像处理:利用MATLAB 的图像处理工具包对图像进行滤波、增强、分割等操作。
3. 算法实现:使用MATLAB 实现常用的算法,如排序、搜索、图像压缩等。
四、实验步骤1. 数据分析:(1)使用MATLAB 的读取数据函数将数据导入MATLAB 环境中。
(2)利用MATLAB 的数据处理函数进行数据清洗和预处理。
(3)使用MATLAB 的统计工具进行数据分析,如求平均值、标准差等。
(4)利用MATLAB 的绘图函数将分析结果可视化。
2. 图像处理:(1)使用MATLAB 的读取图像函数将图像导入MATLAB 环境中。
(2)利用MATLAB 的图像处理工具包进行滤波操作,如均值滤波、中值滤波等。
(3)使用MATLAB 的图像增强函数对图像进行锐化、变换等操作。
(4)利用MATLAB 的图像分割算法对图像进行分割。
3. 算法实现:(1)使用MATLAB 编写排序算法,如冒泡排序、快速排序等。
(2)使用MATLAB 编写搜索算法,如二分查找、线性搜索等。
(3)使用MATLAB 实现图像压缩算法,如离散余弦变换(DCT)。
五、实验结果实验中,我们使用MATLAB 完成了数据分析、图像处理和算法实现的一系列实验操作。
通过数据分析,我们成功导入了数据并对其进行了清洗和预处理,最后得到了数据的统计结果。
在图像处理方面,我们对图像进行了滤波、增强和分割等操作,最终得到了处理后的图像。
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_实习报告范文大全第一篇: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的实验报告

初识MATLAB的实验报告1. 引言MATLAB(Matrix Laboratory)是一种高级的技术计算环境和编程语言。
它具有强大的矩阵计算能力和丰富的科学和工程绘图功能,被广泛应用于各个领域的科研与工程实践中。
本实验旨在初步了解MATLAB的基本语法和功能,通过实际操作加深对MATLAB编程的理解。
2. 实验目的1. 掌握MATLAB的安装和基本使用方法;2. 学习MATLAB中的常用数学函数和操作;3. 了解MATLAB绘图功能并能够绘制简单的图形。
3. 实验步骤3.1 MATLAB安装首先,在官方网站(3.2 MATLAB入门3.2.1 MATLAB语法MATLAB的语法类似于其他常见的编程语言,每个语句以分号结尾。
在MATLAB 中,可以直接进行基本的数学运算,例如加减乘除、指数、对数等。
通过以下代码可以计算两个变量的和并将结果打印出来:matlaba = 10;b = 20;sum = a + b;disp(sum);3.2.2 MATLAB变量在MATLAB中,可以创建和操作各种类型的变量,例如数值、字符串、矩阵等。
以下代码演示了如何创建一个矩阵:matlabmatrix = [1, 2, 3; 4, 5, 6; 7, 8, 9];disp(matrix);3.2.3 MATLAB函数MATLAB提供了许多内置的数学函数,可以直接调用。
以下代码演示了如何计算正弦函数值并打印结果:matlabx = pi/4;y = sin(x);disp(y);3.3 MATLAB绘图MATLAB具有强大的绘图功能,可以绘制各种图形,如曲线、散点图、柱状图等。
以下代码演示了如何绘制一个简单的正弦曲线:matlabx = linspace(0, 2*pi, 100);y = sin(x);plot(x, y);xlabel('x');ylabel('y');title('Sine Curve');4. 实验结果与分析在完成上述实验步骤后,我们成功安装了MATLAB,并学习了基本的语法、变量和函数的使用方法。
matlab实验报告1

matlab实验报告1MATLAB实验报告1摘要:本实验使用MATLAB软件进行了一系列的实验,主要包括数据处理、图像处理和信号处理。
通过实验,我们掌握了MATLAB软件在科学计算和工程领域的应用,深入了解了MATLAB在数据处理、图像处理和信号处理方面的强大功能。
一、数据处理实验在数据处理实验中,我们使用MATLAB对一组实验数据进行了分析和处理。
首先,我们导入了实验数据并进行了数据清洗和预处理,然后利用MATLAB的统计分析工具对数据进行了描述性统计分析,包括均值、方差、标准差等指标的计算。
接着,我们利用MATLAB的绘图工具绘制了数据的直方图和散点图,直观地展现了数据的分布规律和相关性。
二、图像处理实验在图像处理实验中,我们使用MATLAB对一幅图像进行了处理和分析。
首先,我们读取了图像并进行了灰度化处理,然后利用MATLAB的图像滤波工具对图像进行了平滑和锐化处理,最后利用MATLAB的图像分割工具对图像进行了分割和特征提取。
通过实验,我们深入了解了MATLAB在图像处理领域的应用,掌握了图像处理的基本原理和方法。
三、信号处理实验在信号处理实验中,我们使用MATLAB对一组信号进行了处理和分析。
首先,我们生成了一组模拟信号并进行了频域分析,利用MATLAB的信号滤波工具对信号进行了滤波处理,然后利用MATLAB的频谱分析工具对信号的频谱特性进行了分析。
通过实验,我们深入了解了MATLAB在信号处理领域的应用,掌握了信号处理的基本原理和方法。
综上所述,本实验通过对MATLAB软件的应用实验,使我们对MATLAB在数据处理、图像处理和信号处理方面的功能有了更深入的了解,为我们今后在科学计算和工程领域的应用奠定了良好的基础。
MATLAB软件的强大功能和广泛应用前景,将为我们的学习和科研工作提供有力的支持和帮助。
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 。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实习报告实习题目: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)按照顺序查找搜索路径中就是否存在该文件。
如果存在多个名为foo、m得文件,则调用首先查到得文件。
因此,在为变量与函数命名时,需考虑MATLAB得路径搜索顺序,合为变量与函数命名,保证程序得正确运行。
3、熟练运用MATLAB得矩阵运算、多项式运算得运算方法、(第二、三周)例题1:求矩阵方程AX=B,其中,、解:A=[1,2 ,0;1, 3,1;0 ,1,2];B=[1 ,0;0,1;-1 ,0];X=A\BX= 3—4-1 20 -1例题2:求矩阵得行列式,秩,逆,特征值,特征向量,条件数解: a=[2,1,0;1,2,1;0,1,2];det(a)ans=4rank(a)ans=3inv(a)ans=0、7500 —0、50000、2500-0、5000 1、0000 -0、50000、2500-0、50000、7500eig(a)ans=0、58582、00003、4142[V,D]=eig(a)V=0、5000 —0、7071 0、5000 —0、7071-0、00000、70710、50000、70710、5000 D=0、5858 0 00 2、00000003、4142cond(a)ans=5、8284例题5:求积分解:x=0:0、01:1;y=x、*x、*x;trapz(x,y)ans =0、2500例题6:解:f=inline('x、*y’,'x’,’y’);i=dblquad(f,0,1,0,1)i =0、25004、熟悉MATLAB得字符串、单元数组(第四周)2)、字符串得字符串得显示字符串得显示有两种方式:直接显示与利用disp函数进行显示。
字符串得执行3)、字符串得比较字符串得比较主要为比较两个字符串就是否相同,字符串中得子串就是否相同与字符串中得个别字符就是否相同。
用于比较字符串得函数主要就是strcmp 与strncmp。
strcmp:用于比较两个字符串就是否相同。
用法为strcmp(st r1,str2),当两个字符串相同时返回1,否则返回0。
当所比较得两个字符串就是单元字符数组时,返回值为一个列向量,元素为相应行比较得结果.strncmp:用于比较两个字符串得前面几个字符就是否相同。
用法为strncmp(str1,str2,n), 当字符串得前n个字符相同时返回1,否则返回0.当所比较得两个字符串时单元数组时,返回值为列向量,元素为相应行比较得结果。
4)、字符串得查找与替换一个字符串就是由单引号括起来得简单文本.在字符串中得每个字符都就是数组中得一个元素,这些数字就是由ASCII 字符表示得。
这些字符与整数之间可以相互转化。
5、熟悉MATLAB得程序设计(第五周)例1:某日测得从零点开始每隔2小时得环境温度数据如下(℃):12,9,9,10,18,24,28,27,25,20,18,15,13,推测中午1点(即13点)得温度,并画出这一天得温度曲线。
解1)写脚本文件并运行x=0:2:24;y=[12 99 10 1824 2827 2520 1815 13];x1=13; y1=interp1(x,y,x1),y2=interp1(x,y,x1,'spli ne')2)写脚本文件并运行xi=0:1/3600:24;y1i=interp1(x,y,xi);y2i=interp 1(x,y,xi,’spline');plot(x,y,'o’,xi,y1i,'—',xi,y2i,'—、')输出这一天得温度曲线,见图6、熟悉MATLAB得符号计算功能(第六周)1).符号变量、表达式得生成例题1:用sym函数生成符号表达式aex+bsinx解:>>a=sym('a’);b=sym(’b');x=sym('x');e=sym('e');f=a*e^x+b*sin(x)>>f=sym('a*e^x+b*sin(x)’)例题2: 用syms函数生成符号变量解:〉〉syms a bf=a+b〉> syms x y 5syms x y f17、、熟悉MATLAB得绘图及句柄图形(第七、八周)例题1、在一个窗口中画出x=tsin(3t),y=tsint,并适当标注,写出程序并记下简图.解:t=0:0、01:2*pi;x=t、*sin(3*t);y=t、*sin(t);plot(x,y);例题2:利用坐标轴对象实现图形窗口得任意分割x=linspace(0,2*pi,20);y=sin(x);axes('Position',[0、2,0、2,0、2,0、7],’GridLineSty le’,’—、’);plot(y,x);gridonaxes('Position',[0、4,0、2,0、5,0、5]);t=0:pi/100:20*pi;x=sin(t);y=cos(t);z=t、*sin(t)、*cos(t);plot3(x,y,z);axes(’Position’,[0、55,0、6,0、25,0、3]);[x,y]=meshgrid(-8:0、5:8);z=sin(sqrt(x、^2+y、^2))、/sqrt(x、^2+y、^2+eps);mesh(x,y,z);8、学习图形图像在MATLAB中得运用(第九周)数字图像处理主要研究得内容有以下几个方面:(1)图像变换.由于图像阵列很大,直接在空间域中进行处理,涉及计算量很大。
因此,往往采用各种图像变换得方法,如傅立叶变换、沃尔什变换、离散余弦变换等间接处理技术,将空间域得处理转换为变换域处理,不仅可减少计算量,而且可获得更有效得处理(如傅里叶变换可在频域中进行数字滤波处理)。
目前新兴研究得小波变换在时域与频域中都具有良好得局部化特性,它在图像处理中也有着广泛而有效得应用。
(2)图像编码压缩.图像编码压缩技术可减少描述图像得数据量(即比特数),以便节省图像传输、处理时间与减少所占用得存储器容量。
压缩可以在不失真得前提下获得,也可以在允许得失真条件下进行.编码就是压缩技术中最重要得方法,它在图像处理技术中就是发展最早且比较成熟得技术。
(3)图像增强与复原。
图像增强与复原得目得就是为了提高图像得质量,如去除噪声,提高图像得清晰度等。
图像增强不考虑图像降质得原因,突出图像中所感兴趣得部分。
如强化图像高频分量,可使图像中物体轮廓清晰,细节明显;如强化低频分量可减少图像中噪声影响.图像复原要求对图像降质得原因有一定得了解,一般讲应根据降质过程建立“降质模型”,再采用某种滤波方法,恢复或重建原来得图像.(4)图像分割。
图像分割就是数字图像处理中得关键技术之一。
图像分割就是将图像中有意义得特征部分提取出来,其有意义得特征有图像中得边缘、区域等,这就是进一步进行图像识别、分析与理解得基础。
虽然目前已研究出不少边缘提取、区域分割得方法,但还没有一种普遍适用于各种图像得有效方法。
因此,对图像分割得研究还在不断深入之中,就是目前图像处理中研究得热点之一.(5)图像描述。
图像描述就是图像识别与理解得必要前提。
作为最简单得二值图像可采用其几何特性描述物体得特性,一般图像得描述方法采用二维形状描述,它有边界描述与区域描述两类方法。
对于特殊得纹理图像可采用二维纹理特征描述。
随着图像处理研究得深入发展,已经开始进行三维物体描述得研究,提出了体积描述、表面描述、广义圆柱体描述等方法。
四、作品(第十周)1.用xlsread读取xls中数据;用griddata进行三维插值;首先得重新产生向量(x轴与y轴都就是),然后产生网格矩阵,再根据已知数据(xls中给得),对网格矩阵应用griddata数据插值求z值. 2.通过对数字图形图像学习,完成了对图形得“空域变换增强、线性平滑滤波、低通滤波、高通滤波、二值图像分析;五、总结在实验中经常会遇到通过MATLAB生成得图像不令人满意得时候,通过对生成图像得多方面修改总结,我初步掌握了处理图像更加完好得基本方法,这样对以后得应用会有很大得帮助,毕竟我们希望运算出来得结果一目了然,形象而精确.完美得图像就给我们增加了很强得视觉效果让我们更容易理解与认识抽象事务.学习了MATLAB 这门课程,我了解该软件得基本功能,也知道了该软件在我们生活中得重要地位。
随着社会得不断发展,科技得不断进步,计算机得普及,它也被应用在越来越多得方面.MATLAB 得基本数据单位就是矩阵,它得指令表达式与数学、工程中常用得形式十分相似,故用MATLAB来解算问题要比用C, FORTRAN等语言完成相同得事情简捷得多,MATLAB 得最突出得特点就就是简洁。
MATLAB相对于其她得一些编程软件有许多得优点: 一、语言简洁紧凑,使用方便灵活,库函数极其丰富。