上海交通大学交大密西根 联合学院·一 ◆] 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