MATLAB报告范例
MATLAB实验报告(打印版)

MATLAB实验报告班别:09电气3班姓名:李嘉明学号:200924122301实验一/二 MATLAB的基础操作3.自定义一个变量,然后分别用8种不同的数字显示格式显示查看。
>> a=[1.1,1.2,1.3;1.4,1.5,1.6;1.7,1.8,1.9]a =1.1000 1.2000 1.30001.4000 1.5000 1.60001.7000 1.8000 1.9000>> format long>> aa =1.100000000000000 1.200000000000000 1.3000000000000001.400000000000000 1.500000000000000 1.6000000000000001.700000000000000 1.800000000000000 1.900000000000000>> format short e>> aa =1.1000e+000 1.2000e+000 1.3000e+0001.4000e+000 1.5000e+000 1.6000e+0001.7000e+000 1.8000e+000 1.9000e+000>> format long e>> aa =1.100000000000000e+000 1.200000000000000e+000 1.300000000000000e+0001.400000000000000e+000 1.500000000000000e+000 1.600000000000000e+0001.700000000000000e+000 1.800000000000000e+000 1.900000000000000e+000 >> format hex>> aa =3ff199999999999a 3ff3333333333333 3ff4cccccccccccd3ff6666666666666 3ff8000000000000 3ff999999999999a3ffb333333333333 3ffccccccccccccd 3ffe666666666666>> format +>> aa =+++++++++>> format rat>> aa =11/10 6/5 13/107/5 3/2 8/517/10 9/5 19/10>> format short>> aa =1.1000 1.2000 1.30001.4000 1.5000 1.60001.7000 1.8000 1.90005、己举例比较给矩阵的全行赋值,取出矩阵中某一个或几个元素,然后组成一个新的矩阵。
matlab实验报告模板

《高等数学》实验报告(二)实验项目名称:多元函数积分学分组第八组组员姓名学号专业班级实验软件Matlab2010b完成日期实验成绩一、实验目的:加强对Matlab 软件的基本操作,会利用符号计算中int 积分嵌套命令求二重积分、三重积分。
会合理运用int 嵌套命令求解第一类、第二类曲线积分及第一类、第二类曲面积分以及Green 公式及Gauss 公式解题。
结合已经学习的内容,学会分析上述有关内容的综合问题并利用软件给出正确的解答。
二、 实验内容、步骤与结果:8. 计算二重积分 arctan D y d xσ⎰⎰ 其中D 是由圆224x y += 、 及直线y=0, y=x 所围成的在第一象限内的闭区域。
>> syms x y rho theta>> i=int(int(atan(tan(theta))*rho,rho,1,2),theta,0,(0.25)*pi)i =(3*pi^2)/6418. 计算三重积分 e x y z dxdydz ++Ω⎰⎰⎰,其中, 是平面x+y+z=1与三个坐标面围成的立体。
>> syms x y z;>> i=int(int(int(exp(x+y+z),z,0,1),y,0,1-x),x,0,1)i =exp(1) - 128. 计算曲线积分 2()()L x y dx x y dy ++-⎰,其中,L 沿直线从(1,0) 到(0,1), 再沿直线从(0,1)到(-1,0)。
过程syms x y;p=x^2+y;q=x-y;fun=(x^2+y)*diff(p,x)+(x-y)*diff(q,y);I=int(fun,x,1,0);I=int(fun,y,0,1)I =1/2+2*x^3I=int(fun,x,0,-1);I=int(fun,y,1,0)I =-1/2-2*x^3结果由(1,0)到(0,1)I =1/2+2*x^3由(0,1)到(-1,0)I =-1/2-2*x^338求半径为a的球面面积。
MATLAB实验报告实例

MATLAB课程设计院(系)数学与计算机学院专业信息与计算科学班级学生姓名学号指导老师赵军产提交日期实验内容: 1. Taylor逼近的直观演示用Taylor 多项式逼近y = sin x.已知正弦函数的Taylor 逼近式为∑=----=≈nkk kkxxPx1121!)12()1()(sin.实验目的:利用Taylor多项式逼近y = sin x,并用图形直观的演示。
实验结果报告(含基本步骤、主要程序清单、运行结果及异常情况记录等):1.将k从1取到5,得到相应的P = x-1/6*x^3+1/120*x^5-1/5040*x^7+1/362880*x^9;2.用MATLAB进行Taylor逼近,取x的范围是(-3.2,3.2);程序清单如下:syms x; y = sin(x); p = x - (x^3)/6 + (x^5)/120 - (x^7)/5040 + (x^9)/362880 x1 = -3.2:0.01:3.2;ya = sin(x1);y1 = subs(p,x,x1);plot(x1,ya,'-',x1,y1)4.程序运行正常。
思考与深入:取y = sin x 的Taylor 多项式为P 的逼近效果很良好,基本接近y = sin x 的图像,不过随着k 的取值变多,逼近的效果会越来越好。
实验内容: 2. 数据插值在(,)[8,8][8,8]x y =-⨯-区域内绘制下面曲面的图形:2222sin()x y z x y+=+并比较线性、立方及样条插值的结果。
.实验目的:学会用MATLAB对函数进行线性、立方及样条插值,并比较结果。
实验结果报告(含基本步骤、主要程序清单、运行结果及异常情况记录等):1.用MATLAB一次进行对函数的线性、立方、及样条插值,并进行算法误差分析。
2.主要程序如下:[x,y] = meshgrid(-8:1:8,-8:1:8);z = sin((x.^2 + y.^2).^0.5)./((x.^2 + y.^2).^0.5);surf(x,y,z),axis([-8,8,-8,8,-2,3])title('z的曲面图形'); %画出z的曲面图形%选较密的插值点,用默认的线性插值算法进行插值figure;[x1,y1] = meshgrid(-8:0.4:8,-8:0.4:8);z1=interp2(x,y,z,x1,y1);surf(x1,y1,z1),axis([-8,8,-8,8,-2,3])title('线性插值');%立方和样条插值figure;z1=interp2(x,y,z,x1,y1,'cubic');z2=interp2(x,y,z,x1,y1,'spline');surf(x1,y1,z1),axis([-8,8,-8,8,-2,3])title('立方插值');figure;surf(x1,y1,z2),axis([-8,8,-8,8,-2,3])title('样条插值');%算法误差的比较z = sin((x1.^2 + y1.^2).^0.5)./((x1.^2 + y1.^2).^0.5);figure;title('误差分析1');figure;surf(x1,y1,abs(z-z2)),axis([-8,8,-8,8,0,0.025]) title('误差分析2');3.结果如下:4.程序运行正常。
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的基本操作和数字信号处理中常用的函数。
2. 掌握数字信号的离散化、采样、量化等处理方法。
3. 实现数字滤波器的设计和应用。
实验内容:1. 生成并绘制一个正弦波信号,包括频率、幅度和相位等参数。
2. 对信号进行采样,并绘制采样后的离散信号图像。
3. 对采样后的信号进行量化,并绘制量化后的信号图像。
4. 设计一个数字滤波器,并将滤波前后的信号图像进行对比。
实验步骤:1. 生成一个正弦波信号:```matlab% 信号频率为3Hz,幅度为2,相位为0t = 0:0.01:1;f = 3;A = 2;theta = 0;x = A * sin(2*pi*f*t + theta);```2. 绘制信号图像:```matlabplot(t, x);xlabel('时间');ylabel('幅度');title('正弦波信号');```3. 进行信号的采样:```matlab% 采样频率为20Hzfs = 20;Ts = 1/fs;n = 0:Ts:1;xs = A * sin(2*pi*f*n + theta);```4. 绘制采样信号图像:```matlabstem(n, xs);xlabel('时间');ylabel('幅度');title('采样信号');```5. 进行信号的量化:```matlab% 将信号量化为8位bits = 8;delta = (2 * A) / (2^bits);xq = floor(xs / delta + 0.5) * delta;```6. 绘制量化信号图像:```matlabstem(n, xq);xlabel('时间');ylabel('幅度');title('量化信号');```7. 设计数字滤波器:```matlab% 采用FIR滤波器,截止频率为4Hz fcut = 4;n = 100; % 滤波器阶数b = fir1(n, 2*fcut/fs);y = filter(b, 1, xq);```8. 绘制滤波前后的信号图像:```matlabfigure;subplot(2,1,1);stem(n, xq);xlabel('时间');ylabel('幅度');title('量化信号');subplot(2,1,2);stem(n, y);xlabel('时间');ylabel('幅度');title('滤波信号');```实验结果和分析:根据以上实验步骤,可以得到正弦波信号、采样信号、量化信号和滤波信号等图像。
matlab实验报告总结

matlab实验报告总结1.求一份matlab的试验报告计算方法试验报告3【实验目的】检查各种数值计算方法的长期行为【内容】给定方程组x'(t)=ay(t),y'(t)=bx(t), x(0)=0, y(0)=b的解是x-y 平面上的一个椭圆,利用你已经知道的算法,取足够小的步长,计算上述方程的轨道,看看那种算法能够保持椭圆轨道不变。
(计算的时间步长要足够多)【实验设计】用一下四种方法来计算:1. Euler法2. 梯形法3. 4阶RK法4. 多步法Adams公式【实验过程】1. Euler法具体的代码如下:clear;a=2;b=1;A=[0 a; -b0];U=[];u(:,1)=[0;b];n=1000000;h=6*pi/n;fori=1:n delta(i)=((u(1,i)/a)^2+(u(2,i)/b)^2)^0.5; u(:,i+1)=u(:,i)+h*A*u(:,i);endt=1:n+1;subplot(1, 2,1);plot(1:n,delta);gridon;subplot(1,2,2);plot(u(1,:),u(2,:));gridon;max(abs(delta-ones(1,length(delta))));结果如下:2. 梯形法具体的代码如下:clear;a=2;b=1;A=[0 a; -b 0];U=[];u(:,1)=[0;b];n=300;h=6*pi/n;for i=1:n delta(i)=((u(1,i)/a)^2+(u(2,i)/b)^2)^0.5;v1=u(:,i)+h*A*u(:,i);v2=u(:,i)+h*A*(u(:,i)+v1)/2;1u(:,i+1)=u(:,i)+h*A*(u(:,i)+v2)/2;endt=1:n+1;sub plot(1,2,1);plot(1:n,delta);gridon;subplot(1,2,2);结果如下 3. 4阶RK法clear;a=2;b=1;A=[0 a; -b 0];U=[];u(:,1)=[0;b];n=70;h=6*pi/n;for i=1:n delta(i)=((u(1,i)/a)^2+(u(2,i)/b)^2)^0.5;k1=A*u(:,i); k2=A*(u(:,i)+h/2*k2); k3=A*(u(:,i)+h*k3); k4=A*(u(:,i)+h*k3); u(:,i+1)=u(:,i)+h/6*(k1+2*k2+2*k3+k4);endt=1:n+1 ;subplot(1,2,1);plot(1:n,delta);gridon;subplot(1,2,2);结果如下:4. 多步法Adams公式clear;a=2;b=1;A=[0 a; -b 0];U=[];u(:,1)=[0;b];n=200;h=6*pi/n;u(:;2)=u(u,1)+h*A*u(:,1);u(:;3)=u(u,2)+h/2*A*(3*u(:,2)-u(:,1));u(:;4)=u(u,3)+h/12*A*(23*u(:,3)-16*u(:,2)+5*u(:, 1)); delta(1)=((u(1,1)/a)^2+(u(2,1)/b^2)^0.5 delta(2)=((u(1,2)/a)^2+(u(2,2)/b^2)^0.5delta(3)=((u(1,3)/a)^2+(u(2,3)/b^2)^0.5for i=4:n delta(i)=((u(1,i)/a)^2+(u(2,i)/b)^2)^0.5;u(:,i+1)=u(:,i)+h/24*A*(55*u(:,i)-59*u(:,i-1)+37 *u(:,i-1)+37*u(:,i-2)-9*u(:,i-3));endt=1:n+1;sub plot(1,2,1);plot(1:n,delta);gridon;subplot(1,2,2);结果如下:【实验分析】通过这几种方法对比,发现最为稳定的是多步法Adams公式和4阶RK法,其次是梯形法,而欧拉法最为不稳定。
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基本操作与及用法实验报告样本

工程数学课程实验报告(一)[一、实验名称]MATLAB 基本操作与用法[二、实验目的]1、掌握用MATLAB 命令窗口进行简单数学运算。
2、掌握常用的操作命令和快捷键。
3、了解MATLAB 的数据类型。
4、了解MATLAB 的操作符。
[三、实验原理]MATLAB 是美国MathWorks 公司出品的商业数学软件,用于算法开发、数据可视化、数据分析以及数值计算的高级技术计算语言和交互式环境,主要包括MATLAB 和Simulink 两大部分。
MATLAB 是matrix&laboratory 两个词的组合,意为矩阵工厂(矩阵实验室)。
[四、实验条件]实验微机、Matlab 软件。
[五、实验内容和过程]1、在命令窗口依次输入下列命令,根据执行结果分析其功能;helpmagiclookforhelp magicdoc magicwhich magic2、以自己姓名拼音来建立自己的工作目录,再讲自己的工作目录设置到Matlab 搜索路径下。
用cd 命令查询自己的工作目录3、创建变量,并计算:(1) 创建single 类型变量a=98,b=168 ,求:a+b,a-b,b×a3,b×a×a×a(2) 创建uint8 类型变量m,n,值与( 1)同,进行相同计算。
4、先求下列表达式的值,然后记录Matlab 工作空间的使用情况和相关变量[六、实验结果]1、实验结果2、实验结果3、实验结果、实验结果[七、实验结果分析、讨论]根据记录命令和结果,解释实验 3 的(1)与(2)结果为何不同:因uint8 类型变量的最大值为255,当超过最大值时结果就等于255。
[八、实验结论]通过本次实验的学习后,学会用MATLAB 命令窗口进行简单数学运算,常用的操作命令和快捷键等操作。
补充了解语句:input disp sprintf fprintf syms sym max min mod ifswitch forroundnum2str simplifyplot plot3工程数学课程实验报告(二)[一、实验名称]MATLAB 软件在行列式运算中的应用[二、实验目的]1、了解MATLAB 软件在行列式运算中的应用。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
membrane
shadinginterp
light('Position',[-3 -2 1]);
axisoff
functionUntitled_13_Callback(hObject, eventdata, handles)
1.通过下拉菜单或按钮组实现曲面形式、色彩图、光照模式和反射模式的选择;
2.通过三个滚动条用于选择X,Y,Z坐标以确定光源的位置;
3.通过三个滚动条和输入对话框改变视角。
4.加入按钮用于退出演示。
5.提供一些附加功能,比如坐标轴的显示,调用摄像机工具,调用打印预览功能,设置背景颜色,设置标题字体,超链接文档,消息框的调用等。
[x,y]=meshgrid([-1.5:.3:1.5],[-1:0.2:1]);
z=sqrt(4-x.^2/9-y.^2/4);
surf(x,y,z);
shadinginterp
light('Position',[-3 -2 1]);
axisoff
functionUntitled_15_Callback(hObject, eventdata, handles)
functionUntitled_36_Callback(hObject, eventdata, handles)
functionUntitled_34_Callback(hObject, eventdata, handles)
colormapeditor
functionUntitled_45_Callback(hObject, eventdata, handles)
colormap(jet)
functionUntitled_22_Callback(hObject, eventdata, handles)
colormap(hsv)
functionUntitled_23_Callback(hObject, eventdata, handles)
colormap(hot)
functionUntitled_20_Callback(hObject, eventdata, handles)
prompt={'输入方位角','输入俯仰角'};
title='视角控制';
lines=[1 1]';
answer1=inputdlg(prompt,title,lines);
a=answer1{1,1};b=answer1{2,1};
else
gui_mainfcn(gui_State, varargin{:});
end
functionlight_demo_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
(7)最后再加入一个static text,加入标题。
2:菜单设计
设计级联菜单:如图所示,详情请见程序
三、编程(代码过多,详情请见程序)
functionvarargout = light_demo(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename,...
'C:\Documents and Settings\Administrator\My Documents\My Pictures\');
functionUntitled_10_Callback(hObject, eventdata, handles)
surf(peaks);
shadinginterp
colormap(summer)
functionUntitled_27_Callback(hObject, eventdata, handles)
colormap(autumn)
functionUntitled_28_Callback(hObject, evenห้องสมุดไป่ตู้data, handles)
colormap(winter)
t=0:pi/12:3*pi;
r=abs(exp(-t/4).*sin(t));
[x,y,z]=cylinder(r,30);
surf(x,y,z);
shadinginterp
light('Position',[-3 -2 1]);
axisoff
functionUntitled_21_Callback(hObject, eventdata, handles)
functionUntitled_29_Callback(hObject, eventdata, handles)
colormap(gray)
functionUntitled_30_Callback(hObject, eventdata, handles)
colormap(bone)
functionUntitled_31_Callback(hObject, eventdata, handles)
(3)设置5个slider和5个edit text,分别控制视角和光源。
(4)设置三个按钮,分别用于设置背景颜色,设置标题字体,退出
(5)设置一个框架(panel),在框架里放入4个检查盒(checkbox),
(6)分别在axis,pop-up menu,slider,button,panel,checkbox中设置如上图所示的属性
[filename, pathname]=uiputfile({'*.jpg;*.tif;*.png;*.gif','所有图片文件';...
'*.*','所有文件'},'保存文件',...
'C:\Documents and Settings\Administrator\My Documents\My Pictures\');
functionUntitled_24_Callback(hObject, eventdata, handles)
colormap(cool)
functionUntitled_25_Callback(hObject, eventdata, handles)
colormap(spring)
functionUntitled_26_Callback(hObject, eventdata, handles)
'gui_Singleton', gui_Singleton,...
'gui_OpeningFcn', @light_demo_OpeningFcn,...
'gui_OutputFcn', @light_demo_OutputFcn,...
'gui_LayoutFcn', [] ,...
'gui_Callback', []);
ifnargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
ifnargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
colormap(copper)
functionUntitled_32_Callback(hObject, eventdata, handles)
colormap(pink)
functionUntitled_33_Callback(hObject, eventdata, handles)
colormap(lines)
functionUntitled_6_Callback(hObject, eventdata, handles)
[filename, pathname]=uiputfile({'*.jpg;*.tif;*.png;*.gif','所有图片文件';...
'*.*','所有文件'},'图片另文件',...
课程设计报告
课程名称:MATLAB程序设计及应用
设计题目:基于GUI界面的光照效果设计
姓名:
学号:
指导教师:李娟
时间:2010~2011学年第一学期
南京人口学院信息科学系
课程设计题目
基于GUI界面的光照效果设计
课程设计目的及要求:
目的:通过课程设计能熟练的应用MATLAB软件实现编程,了解程序开发过程中用到的一些基础知识,同时熟悉应用程序开发过程,熟悉GUI界面操作……要求:制作一个曲面光照效果的演示界面,能分别实现:
a=msgbox('Matlab课程设计版本1.00 10632114李岩','李岩');
b=findobj(a,'type','text');
c=findobj(a,'type','pushbutton');
set(b,'fontsize',24,'unit','normal');
set(c,'visible','off');
[x,y]=meshgrid(-4:.1:4);