上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_15 Introduction to matlab

上海交通大学交大密西根 联合学院·一 ◆] 181 UM-SJTU Joint Institute ■ University of Michigan Shanghal Jiao Tong University Vg101 Introduction to Computer and Programming Programming In MATLAB
Vg101 Introduction to Computer and Introduction to Computer and Programming Programming Programming In MATLAB

上海交通大学交大密西根 联合学院· 81 UM-SJTU Joint Institute University of Michigan Shanghal Jiao Tong University What is MATLAB It is a high-performance language for technical computing.It integrates computation, visualization,and programming environment. 。 it is a also modern programming language environment:it has sophisticated data structures,contains built-in editing and debugging tools,and supports object-oriented programming. It has many advantages compared to C/C++for solving engineering problems
What is MATLAB What is MATLAB • It is a high-performance language for technical computing. It integrates computation, visualization, and programming environment. • it is a also modern programming language environment: it has sophisticated data structures, contains built-in editing and debugging tools, and supports object-oriented programming. • It has many advantages compared to C/C++ for solving engineering problems

上海交通大学交大密西根 联合学院一 181 UM-SJTU Joint Institute University of Michigan Shanghal Jiao Tong University Examples with MatLab For example,suppose you wanted to plot sin(2 t) Figure 1 日▣☒ Eile Edit Yiew Insert Iools Detktep Yindow Help ·MatLab Commands D宝日色6®Q”®银口国国▣ >>t=-2*pi:pi/100:2*pi; 08 >>plot(t,sin(2*t)); 06 0.4 the first command I means 02 that t is equal to the 02 ordered set of numbers from-2*pi to 2*pi in 0.8 increments of 0.01*pi
Examples with Examples with MatLab • For example, suppose you wanted to plot sin(2 t) • MatLab Commands >> t=-2*pi:pi/100:2*pi; >> plot(t, sin(2*t)); • the first command means that t is equal to the ordered set of numbers from –2*pi to 2*pi in increments of 0.01*pi

上海交通大学交大密西根 联合学院·一 ◆] 181t UM-SJTU Joint Institute University of Michigan Shanghal Jiao Tong University Examples with MatLab Visualizing the equation fxy)=e0.2x0.2 cos(x2y2 over the domain{x×y:x∈[-4,4],y∈[-4,4]} With the LatLab commands like >>[8,Y]=me3 ngrid(-4:.05:4); >>Z=co3(x.人2+Y.^2).*exp(.2*x).*exp(.2*Y); >surfl(X,Y,Z) Plot of z=f(x,y)
Examples with Examples with MatLab • Visualizing the equation over the domain • With the LatLab commands like • Plot of z = f (x, y)

Men us charge. doponding an the U5a1ab灯g0 Mow ar Mava Com and Widow cutsida of laol you are to Workspace Get help changecurren1 dBk的p(udoX currontly using browser. diredory MATLAB Eile Edit Dobug 上askop Wndow Halp 色 D:mmi ies 图 htc支g内oto add Whet's New Current Darectory m. Command Window X F5上 《且人TLA5> Fle Twe bucky.m N-file Copyright 1984-2005 Tha Nathborxe,Ine. caution.mdl Model Vetsion 7.0.4 |R198P21 ■collaizall.asy Editor Aute To get atarted,select NATlAB Heln or Demog from th Qumort Dlre ctory 灯tFse Command History 5---2/23/D4 3:59P1--4 noE画an formet long e -ca d:/myntiles/sea_te -claar -vorkspage dStart Cick start View or axecute Drag the separator bar Enter MATLAB functions a1 button for guck proviously run functions to rasizo wrdaws command-no p on pt. access to tools from he Conmand and more Histo ry window
Started with Started with MatLab MatLab

上海交通大学交大密西根 联合学院一 ◆ UM-SJTU Joint Institute 1Ua日 181t ■ University of Michigan Shanghal Jiao Tong University Calculating with MatLab Direct calculation,ans the default variable for answer,you can name a variable and do arithmetic calculation as in a calculator >>1+2*3 >>X=1+2*3 >>4*X ans X = ans 7 7 28.0000 Table 1.1:Basic arithmetic operators SYMBOL OPERATION EXAMPLE Addition 2+3 Subtraction 2-3 Multiplication 2*3 Division 2/3
Calculating with Calculating with MatLab • Direct calculation, ans the default variable for answer, you can name a variable and do arithmetic calculation as in a calculator

上海交通大学交大密西根 联合学院一 ◆ 1811 UM-SJTU Joint Institute University of Michigan Shanghal Jiao Tong University Started with MatLab Overwrite a variable >> t=5; >>t= t+1 t 6 ·Error message >>X= 10; >>5x ???5x I Error:Unexpected MATLAB expression. ·Precedence >>(1+2)*3 ans 9
Started with Started with MatLab • Overwrite a variable • Error Message • Precedence

上海交通大学交大密西根 联合学院· UM-SJTU Joint Institute University of Michigan Shanghal Jiao Tong University Started with MatLab Display format:Inside MatLab,there is only one date type:double,has 15 digits accuracy >format short >> format long >x=-163.6667 >>x=-1.636666666666667e+002 Get Help,type help command after > 。 Hold the display:putting“;”at the end of a command,will hold display Clear working space:“clear”or“clear all''will erase all the defined variables
Started with Started with MatLab • Display format: Inside MatLab, there is only one date type: double, has 15 digits accuracy • Get Help, type help command after >> • Hold the display: putting “;” at the end of a command, will hold display • Clear working space: “clear” or “clear all” will erase all the defined variables

上海交通大学交大密西根 ·联合学院一 181 UM-SJTU Joint Institute University of Michigan Shanghal Jiao Tong University Math Functions in MatLab cos(x) Cosine abs(x) Absolute value sin(x) Sine sign(x) Signum function tan(x) Tangent max (x) Maximum value acos(x) Arc cosine min(x) Minimum value asin(x) Arc sine ceil(x) Round towards +oo atan(x) Arc tangent floor(x) Round towards -o exp(x) Exponential round(x) Round to nearest integer sqrt (x) Square root rem(x) Remainder after division log(x) Natural logarithm angle(x) Phase angle 1og10(x) Common logarithm conj(x) Complex conjugate
Math Functions in Math Functions in MatLab

上海交通大学交大密西根 联合学院一 ◆] 1811 UM-SJTU Joint Institute University of Michigan Shanghal Jiao Tong University Predefined constants in MatLab Table 2.2:Predefined constant values pi The number,=3.14159... i,j The imaginary unit i,v-1 Inf The infinity,o NaN Not a number
Predefined constants in Predefined constants in MatLab
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 上海交通大学:《数据库系统原理 The principle of Database System》教学资源_Chapter 1 Introduction.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》教学资源_第二章习题与答案(第三版).doc
- 上海交通大学:《数据库系统原理 The principle of Database System》教学资源_第三章习题与答案(第三版).doc
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)chapter8 Views, Indexes.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)Chapter7 Constraints and Triggers.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)Chapter6 The database Language SQL –as a tutorial.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)Chapter5 Algebraic and Logic Query languages.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)chapter4 High-level Database Models.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)chapter3 Design Theory for Relational Databases.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)chapter11 The semi-structured data model Structured data.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)Chapter1 Introduction.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》教学资源_intro.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第二章 8086系统结构.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第一章 绪论(毛义梅).pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第四章 汇编语言程序设计_习题及解答.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第四章 汇编语言程序设计.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第十章 串行通信和可编程接口芯片8251A_习题及解答.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第十一章 A/D和D/A转换_习题及解答.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第八章 可编程计数器_定时器8253_习题及解答.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第八章 可编程计数器/定时器8253及其应用.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_16 MATLAB environment short.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_19 Recursion 1.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_20 Looking Ahead.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Array and its Applications.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_examples on class design.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Expressions and Statements.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_files_DataBase Design.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Function.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Introduction to Computer and Programming.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Introduction to Vg101.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_objects and classes.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_programming style guide for C plusplus.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Random Number_Graphics.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Start with C plusplus.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_vector_string.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Recitation Notes_Recitation 1.ppt
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Recitation Notes_recitation 13.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Recitation Notes_Recitation IX.ppt
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Recitation Notes_Recitation V.ppt
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Recitation Notes_Recitation VII.ppt