MATLAB实训报告

合集下载

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` 函数从外部文件读取数据和将数据保存到文件中。

MatLab实习心得体会2篇

MatLab实习心得体会2篇

MatLab实习心得体会 (3)MatLab实习心得体会 (3)精选2篇(一)在进行MatLab实习的过程中,我学到了很多关于MatLab的知识和技巧,也锻炼了自己的解决问题的能力。

以下是我在实习过程中的一些心得体会:1. 熟练掌握基本语法:MatLab有很多基本的函数和语法,熟练掌握这些基本知识对于编写代码至关重要。

在实习过程中,我花了很多时间学习和练习MatLab的基本语法,以确保我能够正确地使用各种函数和语句。

2. 学会使用文档和资源:MatLab有非常丰富的文档和资源库,可以帮助我们快速解决问题。

在实习过程中,我学会了如何使用MatLab的文档和资源库,并从中获取并应用相关知识。

3. 编写模块化的代码:编写模块化的代码可以使代码更加清晰和可读,也方便后续的调试和维护。

在实习过程中,我尽量将代码分解为不同的功能模块,并使用函数和脚本文件将它们组织起来。

4. 遇到问题要善于查找解决方案:在实习过程中,我遇到了很多问题,有些问题在课堂上并没有涉及到。

在解决这些问题的过程中,我学会了如何善用搜索引擎和MatLab 的社区论坛,通过查找解决方案,我能够更快地解决问题。

5. 多做实践练习:实践是学习MatLab最有效的方法之一。

在实习过程中,我尽量多做一些实践练习,通过实际操作来加深对MatLab的理解和掌握。

总的来说,MatLab实习不仅让我学到了很多关于MatLab的知识和技巧,也使我对编程和问题解决能力有了更深入的认识和提高。

通过实习,我能够更加独立地解决问题,并且对MatLab的应用范围也有了更清晰的认识。

MatLab实习心得体会 (3)精选2篇(二)在MatLab实习期间,我学到了很多关于编程和数据分析方面的知识和技能。

通过实践操作和与同事的合作,我更深入地理解了MatLab的各种功能和用法。

首先,我学会了如何使用MatLab进行数据处理和分析。

我学习了如何导入、清洗和处理数据,以及如何应用不同的统计分析方法来解读数据。

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_实习报告范文大全

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的实验报告

初识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实验报告(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-window on 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 usage 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 first 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) Define 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 the points (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 files 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 behind in 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 one unary 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 for a set of numbers. The rmsaverage of a series of numbers is given as:∑==N i i x N 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 the corner, 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实验报告1

matlab实验报告1

matlab实验报告1MATLAB实验报告1摘要:本实验使用MATLAB软件进行了一系列的实验,主要包括数据处理、图像处理和信号处理。

通过实验,我们掌握了MATLAB软件在科学计算和工程领域的应用,深入了解了MATLAB在数据处理、图像处理和信号处理方面的强大功能。

一、数据处理实验在数据处理实验中,我们使用MATLAB对一组实验数据进行了分析和处理。

首先,我们导入了实验数据并进行了数据清洗和预处理,然后利用MATLAB的统计分析工具对数据进行了描述性统计分析,包括均值、方差、标准差等指标的计算。

接着,我们利用MATLAB的绘图工具绘制了数据的直方图和散点图,直观地展现了数据的分布规律和相关性。

二、图像处理实验在图像处理实验中,我们使用MATLAB对一幅图像进行了处理和分析。

首先,我们读取了图像并进行了灰度化处理,然后利用MATLAB的图像滤波工具对图像进行了平滑和锐化处理,最后利用MATLAB的图像分割工具对图像进行了分割和特征提取。

通过实验,我们深入了解了MATLAB在图像处理领域的应用,掌握了图像处理的基本原理和方法。

三、信号处理实验在信号处理实验中,我们使用MATLAB对一组信号进行了处理和分析。

首先,我们生成了一组模拟信号并进行了频域分析,利用MATLAB的信号滤波工具对信号进行了滤波处理,然后利用MATLAB的频谱分析工具对信号的频谱特性进行了分析。

通过实验,我们深入了解了MATLAB在信号处理领域的应用,掌握了信号处理的基本原理和方法。

综上所述,本实验通过对MATLAB软件的应用实验,使我们对MATLAB在数据处理、图像处理和信号处理方面的功能有了更深入的了解,为我们今后在科学计算和工程领域的应用奠定了良好的基础。

MATLAB软件的强大功能和广泛应用前景,将为我们的学习和科研工作提供有力的支持和帮助。

MATLAB实训报告_2

MATLAB实训报告_2

M AT L A B语言编程实训报告题目MATLAB在信号与系统中的应用年级2008 专业电子信息工程目录第一章绪论 (2)1.1 本设计课题目的及意义, 重点解决的问题 (2)1.1.1 MATLAB在信号与系统中应用的目的及意义 (2)1.1.2 重点解决的问题 (2)1.2 课题的社会和技术背景 (2)1.3 实现的具体功能 (3)第二章课题的基本概念和原理 (4)2.1 MATLAB的概念 (4)2.2 信号与系统的概念 (4)2.3 信号与系统分析的基本内容与方法 (5)2.4 离散系统的基本概念 (6)2.5连续系统模型及表示 (6)第三章系统设计和实现 (7)3.1采用的软件及开发平台 (7)3.1.1系统设计软件 (7)3.1.2开发平台和编程环境 (7)3.2系统的详细设计 (8)3.2.1建模 (8)3.2.2解决方法 (9)3.3系统设计的亮点 (9)第四章结束语 (10)参考文献 (10)第一章绪论1.1 本设计课题目的及意义, 重点解决的问题1.1.1 MATLAB在信号与系统中应用的目的及意义MATLAB在信号与系统中应用能够让学生熟悉MATLAB软件平台、工具箱、高效的数值计算及符号计算功能。

熟悉MATLAB软件的信号处理编程方法和结果的可视化。

了解数字信号处理的计算机仿真方法。

进一步加深对信号与系统的基本原理、方法及应用的理解。

MATLAB软件具有强大的数值分析和计算结果可视化的功能.运用MATLAB软件,通过一个应用实例,将信号与系统课程的理论与实践教学有机地结合,有效地解决了教学中的难点问题,说明了MATLAB软件在信号与系统课程的实践教学中具有重要的实际意义1.1.2 重点解决的问题matlab的基本使用方法, matlab的预定义函数, 如何用matlab绘图, 如何在matlab中编程, 基于matlab的矩阵运算、符号运算、数值分析等。

1.2 课题的社会和技术背景长期以来, “信号与系统”课程一直采用黑板式的单一的教学方式, 学生仅依靠做习题来巩固和理解教学内容, 对课程中大量的应用性较强的内容不能实际动手设计、调试、分析, 严重影响和制约了教学效果。

MATLAB实验报告(8个实验)

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实验心得总结(5篇范例)

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

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

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

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

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

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

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

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

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

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

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

MATLAB实验报告3

MATLAB实验报告3

MATLAB实验报告3MATLAB实验报告3一、实验目的1.掌握MATLAB程序的调试方法;2.掌握MATLAB中的矩阵操作;3.熟悉MATLAB中处理图像的基本操作。

二、实验内容1.用MATLAB调试程序;2.用MATLAB进行矩阵运算;3.用MATLAB处理图像。

三、实验原理及步骤1.MATLAB程序的调试方法在MATLAB中调试程序可以采用设置断点、逐行运行、单步调试等方法。

设置断点可以在程序中的其中一行上点击左键,会出现一个红色的圆点表示断点已设置。

逐行运行可以通过点击Editor界面上的运行按钮实现。

单步调试可以通过点击断点所在行的左侧按钮实现。

2.矩阵运算在MATLAB中,对于矩阵的运算可以使用一些基本的函数,如矩阵加法、减法、乘法等。

矩阵加法可以使用"+"操作符实现,减法可以使用"-"操作符实现,乘法可以使用"*"操作符实现。

另外,MATLAB还提供了一些更复杂的矩阵运算函数,如矩阵的转置、逆等。

3.图像处理在MATLAB中,可以使用imread函数加载图像文件,使用imshow函数显示图像,使用imwrite函数保存图像。

另外,还可以使用一些图像处理函数对图像进行处理,如灰度化、二值化、平滑滤波等。

四、实验步骤1.调试程序首先,在MATLAB的Editor界面中打开要调试的程序文件。

然后,在程序的其中一行上点击左键,即设置了一个断点。

最后,点击运行按钮,程序会在断点处停下,然后可以通过单步调试和逐行运行来逐步查看程序的执行过程和变量的取值。

2.矩阵运算首先,定义两个矩阵A和B,并赋值。

然后,使用"+"操作符对两个矩阵进行相加,得到矩阵C。

最后,使用disp函数显示矩阵C的值。

3.图像处理首先,使用imread函数加载一张图像。

然后,使用imshow函数显示加载的图像。

接着,使用rgb2gray函数将彩色图像转换为灰度图像。

(完整word)Matlab实验报告

(完整word)Matlab实验报告

实验一:Matlab操作环境熟悉一、实验目的1.初步了解Matlab操作环境.2.学习使用图形函数计算器命令funtool及其环境。

二、实验内容熟悉Matlab操作环境,认识命令窗口、内存工作区窗口、历史命令窗口;学会使用format 命令调整命令窗口的数据显示格式;学会使用变量和矩阵的输入,并进行简单的计算;学会使用who和whos命令查看内存变量信息;学会使用图形函数计算器funtool,并进行下列计算:1.单函数运算操作。

求下列函数的符号导数(1)y=sin(x);(2) y=(1+x)^3*(2-x);求下列函数的符号积分(1)y=cos(x);(2)y=1/(1+x^2);(3)y=1/sqrt(1—x^2);(4)y=(x1)/(x+1)/(x+2)求反函数(1)y=(x-1)/(2*x+3); (2) y=exp(x);(3) y=log(x+sqrt(1+x^2));代数式的化简(1)(x+1)*(x-1)*(x-2)/(x-3)/(x—4);(2)sin(x)^2+cos(x)^2;(3)x+sin(x)+2*x—3*cos(x)+4*x*sin(x);2.函数与参数的运算操作。

从y=x^2通过参数的选择去观察下列函数的图形变化(1)y1=(x+1)^2(2)y2=(x+2)^2(3) y3=2*x^2 (4) y4=x^2+2 (5) y5=x^4 (6) y6=x^2/2 3.两个函数之间的操作求和(1)sin(x)+cos(x) (2) 1+x+x^2+x^3+x^4+x^5乘积(1)exp(—x)*sin(x) (2) sin(x)*x商(1)sin(x)/cos(x); (2) x/(1+x^2); (3) 1/(x—1)/(x—2); 求复合函数(1)y=exp(u) u=sin(x) (2) y=sqrt(u) u=1+exp(x^2)(3) y=sin(u) u=asin(x) (4) y=sinh(u) u=-x实验二:MATLAB基本操作与用法一、实验目的1.掌握用MATLAB命令窗口进行简单数学运算。

matlab实习报告二5篇

matlab实习报告二5篇

matlab实习报告二5篇第一篇:matlab实习报告二MATLAB实习报告(2)实验二 MATLAB矩阵分析与处理王夏一、实验目的1、掌握生成特殊矩阵的方法。

2、掌握矩阵分析的方法。

3、用矩阵求逆发解线性方程组。

二、实验内容1、设有分块矩阵A=[E3×3 R3×2;O2×3 S2×2],其中E、R、O、S分别为单位矩阵、随机矩阵、零矩阵和对角阵,试通过数值计算验证A²=[E R+RS;O S²]。

程序清单:E=eye(3);R=rand(3,2);O=zeros(2,3);S=diag([4,5]);A=[E R;O S] ;A2=A^2;C=[E R+R*S;O S^2];length(find(A2==C))==25 运行结果:ans =12、产生5阶希尔伯特矩阵H和5阶帕斯卡矩阵P,且求其行列式的值Hh和Hp以及他们的条件数Th和Tp,判断哪个矩阵的性能更好,为什么?程序清单:format rat H=hilb(5);format short P=pascal(5);Hh=det(H);Hp=det(P);Th=cond(A);Tp=cond(P);运行结果:Hh =3.7493e-012 Hp =1 Th =5.5228 Tp =8.5175e+003 实验收获:会建立希尔伯特矩阵和帕斯卡矩阵,知道怎么求矩阵行列式的值以及条件数。

希尔伯特矩阵的性能更好,条件数越接近1的矩阵性能越好。

3、建立一个5×5矩阵,求它的行列式值、迹、秩和范数。

程序清单:A=[1:5;1:0.1:1.5;2 5 7 3 9;2:6;3:0.4:4.6]Ha=det(A);Ra=rank(A);Ta=trace(A);Na=norm(A);运行结果:Ha =1.4421e-031 Ra = 3 Ta =18.7000 Na =19.49664、已知向量A,求A的特征值及特征向量,并分析其数学意义。

matlab实验报告(实验4)

matlab实验报告(实验4)

学生实验报告开课学院及实验室: 机电学院2012年12月21日学院机电学院年级、专业、班姓名学号实验课程名称MATLAB程序设计成绩实验项目名称实验4: 数据和函数的可视化指导老师一、实验目的1、掌握MATLAB绘图的基本步骤和相关指令调用的先后顺序。

2、掌握MATLAB绘图指令的调用方法。

二、实验内容数学函数从形式上可以分为离散函数和连续函数。

MATLAB对这两种函数数据的可视化都提供了相应的指令。

仔细阅读教材【例5.1-1】的实现代码, 运行并保存结果;并改用stem函数, 画出【例5.1-1】的序列图。

仔细阅读教材【例5.1-2】的实现代码, 运行并保存结果;并分别使用描点和连折线方式, 画出连续函数y=xcosx的近似图形(采样点数自定, 要求画出的图尽量接近原连续函数的图)。

仔细阅读【例5.2-2】的实现代码, 理解plot指令画多条曲线的运用方法, 运行并保存结果;并使用plot函数和legend函数, 在同一个图形窗口上画出y=sint和y=sin(2t)在[0,2pi]区间上的图形, 并标出图例。

仔细阅读【例5.2-4】的实现代码, 理解图形标识选项的运用方法, 运行并保存结果;并修改代码, 把“sin(t)”字体改为正体, 大小改为20, “极大值”改为宋体。

阅读【例5.2-6】, 理解使用hold on指令画多幅图的方法, 运行并保存结果。

阅读【例5.2-8】, 理解使用subplot函数画多个子图的方法, 运行并保存结果。

(1)综合实验: 阅读以下关于通过绘制二阶系统阶跃响应综合演示图形标识的示例, 理解示例中所有图形标识指令的作用, 掌握各个图形标识指令的运用方法, 并在原指令上改动以实现以下功能:(2)把横坐标范围改为0至5pi, 纵坐标范围改为0至2;(3)把图中的横轴的刻度改为从0开始到4pi, 中间各点间隔为pi/2;纵轴刻度改为从0开始到1.5, 中间各点间隔为0.3;(4)把图中的α改为σ。

Matlab实验报告_3

Matlab实验报告_3

程序设计训练报告题目13.三角函数图形的显示15.子窗口显示图形学生姓名学生学号专业班级指导老师2012 年6 月22 日一、实验名称:用matlab处理基本运算与画图二、实验目的:1.掌握二维曲线绘图的基本方法与命令;2.掌握一个窗口多个图形的画法,分割子窗口的画法;三、实验说明:plot:画坐标图的基本命令,可以通过此命令指定曲线样式;grid on:画出网格;xlabel\ylable:标出横\纵坐标;title:给图表名称;legend:指定标注位置及曲线标注名称;text:在图上添加文字说明;axis:控制坐标范围;subplot:分割窗口并指定下一图所在窗口;plotyy:画双纵坐标;四、实验内容:1.在区间x=0: π/100:2*π内,在同一坐标系中绘制曲线y1=sin(x),y2=cos(x),并对图形加上一些说明。

代码如下:x=0:pi/100:2*pi;y1=sin(x);y2=cos(x);plot(x,y1,'-.square b',x,y2,'-diamond r'); %画出图形grid on; %画出网格xlabel('时间'); %添加坐标名称ylabel('正弦、余弦');title('正弦和余弦曲线'); %添加图形标题legend('正弦','余弦',-1); %添加标注及指定标注位置text(2.5,sin(2.5),' \leftarrow sin(x)','FontSize',18); %在图形上添加说明text(0.6,cos(2.3),' cos(x) \rightarrow','FontSize',18);axis([0 2*pi -1.1 1.1]); %控制坐标范围实验结果:2.在第1个子窗口用极坐标画图显示r=0.5(1+cos(θ)),其中θ∈[0,2π];在第2个子窗口作填充图,填充坐标矢量为X=[0 0.2 0.8 10.5 0],Y=[1 0 0 1 1.8 1],填充颜色为蓝色;在第3个子窗口作双y轴图y1=sin(t),t∈[0,4π],y2=20*cos(t);在第4个子窗口显示相图x=sin(t),y=cos(t).代码如下:theta=0:0.1:2*pi;rho=0.5*(1+cos(theta));subplot(2,2,1); %指定下图画在窗口一polar(theta,rho);x=[0 0.2 0.8 1 0.5 0];y=[1 0 0 1 1.8 1];subplot(2,2,2);hold on;plot(x,y);fill(x,y,'b'); %填充(需指定填充颜色)t=0:0.1:4*pi;subplot(2,2,3);y1=sin(t);y2=20*cos(t);plotyy(t,y1,1.5*y1+pi,y2); %画双纵坐标图x=sin(theta);y=cos(theta);subplot(2,2,4);plot(x,y);实验结果:五、实验体会:任何一门编程语言,在使用过程中,都必须做到细心。

matlab 实验报告

matlab 实验报告

matlab 实验报告Matlab实验报告引言:Matlab是一种强大的数值计算和可视化软件,广泛应用于科学、工程和经济等领域。

本实验报告将介绍我在使用Matlab进行实验过程中的一些经验和结果。

实验一:矩阵运算在这个实验中,我使用Matlab进行了矩阵运算。

首先,我创建了一个3x3的矩阵A和一个3x1的矩阵B,并进行了矩阵相乘运算。

通过Matlab的矩阵乘法运算符*,我得到了一个3x1的结果矩阵C。

接着,我对矩阵C进行了转置操作,得到了一个1x3的矩阵D。

最后,我计算了矩阵C和矩阵D的点积,并将结果输出。

实验二:数据可视化在这个实验中,我使用Matlab进行了数据可视化。

我选择了一组实验数据,包括时间和温度两个变量。

首先,我将数据存储在一个矩阵中,并使用Matlab的plot函数将时间和温度之间的关系绘制成曲线图。

接着,我使用Matlab的xlabel、ylabel和title函数添加了横轴、纵轴和标题。

最后,我使用Matlab的legend函数添加了图例,以便更好地理解图表。

实验三:数值积分在这个实验中,我使用Matlab进行了数值积分。

我选择了一个函数f(x)进行积分计算。

首先,我使用Matlab的syms函数定义了符号变量x,并定义了函数f(x)。

接着,我使用Matlab的int函数对函数f(x)进行积分计算,并将结果输出。

为了验证结果的准确性,我还使用了Matlab的diff函数对积分结果进行了求导操作,并与原函数f(x)进行了比较。

实验四:信号处理在这个实验中,我使用Matlab进行了信号处理。

我选择了一个音频文件,并使用Matlab的audioread函数读取了该文件。

接着,我使用Matlab的fft函数对音频信号进行了傅里叶变换,并将结果绘制成频谱图。

为了进一步分析信号的特征,我还使用了Matlab的spectrogram函数绘制了信号的时频图。

通过对信号的频谱和时频图的观察,我可以更好地理解信号的频率和时域特性。

MATLAB实验报告_8

MATLAB实验报告_8

实验一基本操作和简单语句输入一、实验环境计算机MATLAB软件二、实验目的1.熟悉MA TLAB的命令窗口。

2、掌握MATLAB的一些基本操作, 能够进行一般的数值计算。

3.实现语句的重调和修改。

三、实验内容与步骤1.启动MA TLAB2.观察MA TLAB窗口的各个组成部分(1)了解菜单栏各窗口项的功能, 用鼠标打开MA TLAB的各个菜单, 在状态栏里显示当前鼠标所指的菜单项的含义。

(2)用鼠标指向常用工具栏的每个工具按钮, 了解各工具按钮的含义。

3.命令窗口的打开和关闭(1)查看菜单窗口中有哪些菜单命令。

(2)在命令窗口中输入命令a=3;b=4;y=a*b+a/b, 然后回车, 查看命令显示结果。

>> a=3;b=4;y=a*b+a/b,y =12.7500(3)利用MA TLAB中编辑命令时常用的按键功能, 调用上一个语句, 对它进行修改(如把分号改成逗号, 看运行结果), 并把运行结果复制到word中保存。

>> a=3,b=4,y=a*b+a/b,a =3b =4y =12.7500(4)关闭命令窗口。

(5)打开命令窗口。

4.使用MA TLAB帮助熟悉MATLAB的帮助系统, 通过帮助系统了解有关内容。

5、在命令窗口中输入demo, 将出现MA TLAB的演示窗, 通过演示窗, 对MATLAB的功能进行一次浏览。

四、练习1.计算y=x^3+(x-0.98)^2/(x+1.25)^3-5*(x+1/x), x=2, x=3时的值。

>> x=2;y=x^3+(x-0.98)^2/(x+1.25)^3-5*(x+1/x)y =-4.4697>> x=3;y=x^3+(x-0.98)^2/(x+1.25)^3-5*(x+1/x)y =10.38652.计算cos(pi/3)-sqrt(9-sqrt(2))>> cos(pi/3)-sqrt(9-sqrt(2))ans =-2.25423.已知: a=3,A=4,b=a^2,B=b^2-1,c=a+A-2*B,C=a+B+2*c, 求: C>> a=3;A=4;b=a^2;B=b^2-1;c=a+A-2*B;C=a+B+2*cC =-2234.复数z1=1+3*i,z2=1+2*i,z3=2*exp((pi/6)*i),求z=(z1*z2)/z3>> z1=1+3*i;z2=1+2*i;z3=2*exp((pi/6)*i);z=(z1*z2)/z3z =-0.9151 + 3.4151i实验二矩阵和数组的操作一、实验环境计算机MATLAB软件二、实验目的1.掌握矩阵和数组的一般操作, 包括创建、保存、修改和调用等。

MATLAB实验报告1

MATLAB实验报告1

MATLAB实验报告1MATLAB实验报告1实验题目:使用MATLAB绘制正弦函数图像一、实验目的通过本次实验,我们将学会使用MATLAB软件绘制函数图像,加深对正弦函数性质的理解,并掌握MATLAB基本绘图函数的使用。

二、实验原理正弦函数是数学中常见的一种函数,其表达式为y = A * sin(ω *t + φ),其中A为振幅,ω为角速度,t为时间,φ为相位角。

三、实验步骤1.打开MATLAB软件,在命令窗口输入以下指令创建一个时间向量t,并以0.01为间隔,从0到2π生成值:t = 0:0.01:2*pi;2.输入以下指令生成正弦函数序列y,并设定振幅A为1,角速度ω为1,相位角φ为0:y = sin(t);3. 使用plot函数绘制正弦函数图像,输入以下指令:plot(t, y);title('Sin(x) Function');xlabel('Time');ylabel('Amplitude');xlim([0, 2*pi]);5.运行程序,即可获得正弦函数的图像。

四、实验结果分析(插入正弦函数图像)从图中可以看出,正弦函数以x轴为中心呈现周期性的波动,振幅为1、当x取0时,正弦函数的值为0;当x取π/2时,正弦函数的值为1;当x取π时,正弦函数的值为0;当x取3π/2时,正弦函数的值为-1;当x取2π时,正弦函数的值为0,周期为2π。

五、实验心得体会通过本次实验,我对MATLAB的基本绘图函数的使用有了初步了解和实践,提高了自己的实际操作能力,并对正弦函数的性质有了深入的认识。

在今后的实验中,我将继续深入学习和应用MATLAB软件,提高自己的数据分析和图像处理能力。

matlab实验一实验报告

matlab实验一实验报告

matlab实验一实验报告实验一:Matlab实验报告引言:Matlab是一种强大的数学软件工具,广泛应用于科学计算、数据分析和工程设计等领域。

本实验旨在通过使用Matlab解决实际问题,探索其功能和应用。

一、实验目的本次实验的主要目的是熟悉Matlab的基本操作和常用函数,了解其在科学计算中的应用。

二、实验内容1. 数值计算在Matlab中,我们可以进行各种数值计算,包括基本的加减乘除运算,以及更复杂的矩阵运算和方程求解。

通过编写相应的代码,我们可以实现这些功能。

例如,我们可以使用Matlab计算两个矩阵的乘积,并输出结果。

代码如下:```matlabA = [1 2; 3 4];B = [5 6; 7 8];C = A * B;disp(C);```2. 数据可视化Matlab还提供了强大的数据可视化功能,可以将数据以图表的形式展示出来,更直观地观察数据的规律和趋势。

例如,我们可以使用Matlab绘制一个简单的折线图,来展示某个物体在不同时间下的位置变化。

代码如下:```matlabt = 0:0.1:10;x = sin(t);plot(t, x);xlabel('Time');ylabel('Position');title('Position vs. Time');```3. 图像处理Matlab还可以进行图像处理,包括图像的读取、处理和保存等操作。

我们可以通过Matlab对图像进行增强、滤波、分割等处理,以及进行图像的压缩和重建。

例如,我们可以使用Matlab读取一张图片,并对其进行灰度化处理。

代码如下:```matlabimg = imread('image.jpg');gray_img = rgb2gray(img);imshow(gray_img);```三、实验结果与分析在本次实验中,我们成功完成了数值计算、数据可视化和图像处理等任务。

matlab实验一实验报告

matlab实验一实验报告

matlab实验一实验报告一、实验目的本次实验的主要目的是熟悉 MATLAB 软件的基本操作环境和编程语法,通过实际编写和运行简单的程序,初步掌握 MATLAB 在数值计算、图形绘制和数据处理方面的基本功能。

二、实验环境本次实验使用的是 MATLAB R2020a 版本,运行在 Windows 10 操作系统上。

计算机配置为:Intel Core i5 处理器,8GB 内存。

三、实验内容及步骤1、矩阵运算创建一个 3×3 的矩阵 A,元素分别为 1 到 9。

创建一个 3×3 的零矩阵 B。

计算 A+B 和 A×B 的结果。

在 MATLAB 中,我们可以使用以下代码实现:```matlabA = 1 2 3; 4 5 6; 7 8 9;B = zeros(3);C = A + B;D = A B;disp(C);disp(D);```2、数据类型转换定义一个整数变量 x 为 5。

将 x 转换为双精度浮点数。

将 x 转换为字符串类型。

代码如下:```matlabx = 5;y = double(x);z = num2str(x);disp(y);disp(z);```3、函数调用定义一个函数 fun,输入参数为 x,返回值为 x 的平方。

调用函数 fun,计算 3 的平方。

函数定义及调用代码:```matlabfunction y = fun(x)y = x^2;endresult = fun(3);disp(result);```4、图形绘制绘制函数 y = sin(x)在区间0, 2π上的图像。

使用以下代码实现:```matlabx = 0:001:2pi;y = sin(x);plot(x, y);```四、实验结果1、矩阵运算A+B 的结果为:```matlab1 2 34 5 67 8 9```A×B 的结果为:```matlab0 0 00 0 00 0 0```2、数据类型转换将整数 5 转换为双精度浮点数,结果为 50000。

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

一、实训目的1. 熟悉MATLAB语言的使用2. 了解MATLAB在电子信息课程中的应用3. 掌握MATLAB矩阵输入、运算以及MATLAB数值的运算功能4.掌握各种数据的创建、访问、扩建及缩减5.了解利用MATLAB计算系统响应的方法;验证信号与系统的基本概念、基本理论,掌握信号与系统的分析方法。

二、实训任务和要求1、熟练利用MATLAB语言编程对系统S平面分析2、掌握利用MATLAB分析系统时域的方法,熟悉系统的零输入响应,零状态响应及冲击响应的步骤。

3、MATLAB是目前国际上最流行,应用最广泛的科学与工程计算软件,它由MATLAB语言,MATLAB工作环境,MATLAB图像处理系统,MATLAB数据函数库,MATLAB 应用程序接口五大部分组成的集数值计算,图形处理,程序开发为一体的功能强大的系统.它应用于自动控制,数学计算,信号分析,计算机技术,图像信号处理,财务分析,航天工业,汽车工业,生物医学工程,语音处理和雷达工程等各行业,也是国内高校和研究部门进行许多科学研究的重要工具。

MATLAB的基本数据单位是矩阵,它的指令表达式与数学,工程中常用的形式十分相似,故用MATLAB来解算问题要比用C,FORTRAN等语言完相同的事情简捷得多。

MATLAB是“矩阵实验室”(MATrix LABoratoy)的缩写,它是以矩阵运算为基础的交互式程序语言,能够满足科学、工程计算和绘图的需求。

与其它计算机语言相比,其特点是简洁和智能化,适应科技专业人员的思维方式和书写习惯,使得编程和调试效率大大提高。

它用解释方式工作,键入持续后立即得出结果,人机交互性能好,易于调试并被科技人员所乐于接受。

特别是它可适应多种平台,并且随着计算机硬软件的更新及时升级,因此MATLAB语言在国外的大学工学院中,特别是频繁进行数值计算的电子信息类学科中,已经成为每个学生都掌握的工具了。

它大大提高了课程教学、解题作业、分析研究的效率。

4、系统S平面分析的基本理论MATLAB在系统S平面分析中,一般是求系统函数的零极点分布图,画单位冲激响应和幅频响应的图形,通常按常规方法这些波形很难画出,但是应用MATLAB就可简便快捷的画出图形,使系统的分析更加便捷.例如,已知系统函数为H,利用MATLAB 画出该系统的零极点分布图,求出该系统的单位冲激响应和幅频响应,并判断系统的稳定性。

源程序如下:> > % program 2 Impulse response,amp;itude fequency response and stability analysis of LTI H(s) >>Bum=[1];den=[1 2 2 1];>>sys=tf(Bum,den);>>poles=roots(den):>>figure(1);pzmap(sys);t=O: 0.02: 10:>>h=impulse(Bum,den,t);>>figure(2);plot(t,h);>>xlabel( t(s) );ylabel( h(t) );title( Im—pulse Response );>>[H,W]=freqs(Bum,den);>>figure(3);plot(W,abs(H));>>xlabel( ang.freq.\omega(rad/s) );yla—bel( H(j\omega) );title( Magnitude Respone );> grid on程序运行的结果如图一,图二,图三所示:图一系统函数零极点分布图形图二系统的单位冲激响应图三系统的幅频响应5、MATLAB系统时域求解的基本函数求取系统单位阶跃响应:step()求取系统的冲激响应:impulse()y=step(num,den,t):其中num和den分别为系统传递函数描述中的分子和分母多项式系数,t为选定的仿真时间向量,一般可以由t=0:step:end等步长地产生出来。

该函数返回值y为系统在仿真时刻各个输出所组成的矩阵[y,x,t]=step(num,den):此时时间向量t由系统模型的特性自动生成, 状态变量x返回为空矩阵。

[y,x,t]=step(A,B,C,D,iu):其中A,B,C,D为系统的状态空间描述矩阵,iu用来指明输入变量的序号。

x为系统返回的状态轨迹。

impulse()函数的用法求取脉冲激励响应的调用方法与step()函数基本一致。

y=impulse(num,den,t);[y,x,t]=impulse(num,den);[y,x,t]=impulse(A,B,C,D,iu,t)covar:连续系统对白噪声的方差响应initial:连续系统的零输入响应lsim:连续系统对任意输入的响应对于离散系统只需在连续系统对应函数前加d就可以,如dstep,dimpulse等。

三、实训过程与内容1、采用的软件及开发平台MATLAB7.0 计算机2、系统的详细设计(一)、MATLAB 中系统S 平面分析的基本函数(a )Laplace 拉普拉斯变换 语法: laplace(F) laplace(F,t) fourier(F,w,z) 简介:L = laplace(F)表示对F 函数关于默认自变量t 做拉普拉斯变换。

默认结果是关于s 的函数。

拉普拉斯变换完成了时域函数到频域函数的转换。

L= laplace(F,t) 会令L 为t 的函数,而非默认的s 。

L = laplace(F,w,z)规定F 是关于w 的函数,而L 是关于z 的函数。

(b) ilaplace 拉普拉斯逆变换 用法:F = ilaplace(L) F = ilaplace(L,y) F = ilaplace(L,y,x) 简介:F = ilaplace(L)将L(s)变换成F(t)F = ilaplace(L,y)将L(s)变换为F(y),而非F(t) F = ilaplace(L,y,x)将L(y)变换为F(x)(二)分析与实现(1)由系统函数零、极点分布决定时域特性当H(s)极点(一阶)p j σω=+中σ和ω的取值为0.06:0.03:0.06σ=-,0.5:0.25:0ω=-时,画出对应于h(t)波形,并分析波形。

解:首先,根据s域的函数H(S),做拉普拉斯逆变换求出时域函数h(t) ,绘制h(t)的图形。

代码及波形图如下:(1)clear;clc (2)clear;clc (3)clear;clcsyms s; syms s; syms s;H=1/(s-(-0.06+0.5*j)); H=1/(s-(-0.06+0.25*j));H=1/(s+0.06);h=real(ilaplace(H)); h=real(ilaplace(H));h=real(ilaplace(H));ezplot(h) ezplot(h)ezplot(h)(4)clear;clc (5)clear;clc (6)clear;clc syms s; syms s; syms s;H=1/(s-(-0.03+0.5*j)); H=1/(s-(-0.03+0.25*j)); H=1/(s+0.03);h=real(ilaplace(H)); h=real(ilaplace(H));h=real(ilaplace(H));ezplot(h) ezplot(h) ezplot(h)(7)clear;clc (8)clear;clc (9)clear;clc syms s; syms s; syms s;H=1/(s-0.5*j); H=1/(s-0.25*j); H=1/s;h=real(ilaplace(H)); h=real(ilaplace(H));h=real(ilaplace(H));ezplot(h) ezplot(h) ezplot(h)(10)clear;clc (11)clear;clc (12)clear;clcsyms s; syms s; syms s;H=1/(s-(0.03+0.5*j)); H=1/(s-(0.03+0.25*j)); H=1/(s-0.03);h=real(ilaplace(H)); h=real(ilaplace(H));h=real(ilaplace(H));ezplot(h) ezplot(h)ezplot(h)(13)clear;clc (14)clear;clc (15)clear;clcsyms s; syms s; syms s;H=1/(s-(0.06+0.5*j)); H=1/(s-(0.06+0.25*j)); H=1/(s-0.06);h=real(ilaplace(H)); h=real(ilaplace(H));h=real(ilaplace(H));ezplot(h) ezplot(h)ezplot(h)(2)由系统函数零、极点分布决定频率特性若H(s)零极点分布如图1所示,讨论他们是何种类型的滤波器,画出其幅频特性曲线。

σj ω⨯⨯()a 0σj ω⨯()b ⨯0σj ω⨯()c ⨯0σj ω⨯⨯()d 0σj ω⨯⨯0j ω0j ω-0σj ω⨯⨯()e 1j ω1j ω-1j ω1j ω-2j ω-2j ω2j ω2j ω- 系统零极点分布图(a) 低通滤波器 clear;clc w=0:0.01:5; w1=0;w2=0; k=0;H=1./(((w-w1)*i+(k+1)).* ((w-w2)*i+(k+2)));plot(w,H)(b) 低通滤波器clear;clcw=0:0.01:5;w1=0;w2=0;k=0;H=(w+3)./(((w-w1)*i+(k+1)).* ((w-w2)*i+(k+2)));plot(w,H)(c) 低通滤波器clear;clcw=0:0.01:5;H=(w+3)./((w*i+1).*(w*i+2));plot(w,H)(d) 带通滤波器clear;clcw=0:0.01:5;w1=2;w2=-2;k=0;H=w./(((w-w1)*i+(k+1)).* ((w-w2)*i+(k+2)));plot(w,H)(e) 高通滤波器clear;clcw=0:0.01:5;w1= 2;w2=-2;o1=3;o2=-3;k=0;H=(w-o1).*(w-o2)./(((w-w1)*i+(k+1)).* ((w-w2)*i+(k+2)));plot(w,H)grid on(f) 高通滤波器clear;clcw=0:0.01:5;w1=2;w2=-2; o1=3;o2=-3; k=0;H=(w-o1).*(w-o2)./(((w-w1)*i+(k+1)).* ((w-w2)*i+(k+2))); plot(w,H) grid on(3)、零输入响应与零状态响应零输入响应:就是系统中的输入至始至终都是0,电路反应完全靠电路中的储能设备(电容电感)来释放能量。

相关文档
最新文档