同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 02 MATLAB Basics(负责人:陈明)

Chapter 2:MATLAB Basics Part 1:Variables and Arrays Part 2:Multidimensional Arrays ▣Part3:Subarrays Part 4:Special Values Part 5:Displaying Output Data Part 6:Scalar and Array Operations Part 7:Hierarchy of Operations Part 8:Built-in Functions 细月济大学 TONGJI UNIVERSITY
Chapter 2: MATLAB Basics Part 1: Variables and Arrays Part 2: Multidimensional Arrays Part 3: Subarrays Part 4: Special Values Part 5: Displaying Output Data Part 6: Scalar and Array Operations Part 7: Hierarchy of Operations Part 8: Built-in Functions

MATLAB Basics(1/40) Variables and Arrays Variable is a name given to a reserved location in memory 。class code=l1l; number of students =65; name ="Tongji University'; radius 5; area pi radius 2; @日济大学 TONGJI UNIVERSITY
➢ Variable is a name given to a reserved location in memory • class_code = 111; • number_of_students = 65; • name = ‘Tongji University’; • radius = 5; • area = pi * radius^2; MATLAB Basics(1/40) Variables and Arrays

MATLAB Basics(2/40) Variables and Arrays Use meaningful names for variables MATLAB variable names .must begin with a letter can contain any combination of letters,numbers and underscore ( must be unique in the first 31 characters >MATLAB is case sensitive: ·“name',Name”and“NAME”are considered different variables Never use a variable with the same name as a MATLAB command CPHAW Naming convention:use lowercase letters 月停大学 TONGJI UNIVERSITY
MATLAB Basics(2/40) Variables and Arrays ➢ Use meaningful names for variables ➢ MATLAB variable names • must begin with a letter • can contain any combination of letters, numbers and underscore (_) • must be unique in the first 31 characters ➢ MATLAB is case sensitive: • “name”, “Name” and “NAME” are considered different variables ➢ Never use a variable with the same name as a MATLAB command ➢ Naming convention: use lowercase letters

MATLAB Basics(3/40) Variables and Arrays >The fundamental unit of data is array colurgealar vector row 3 1 -3 11 15 -2 3 21 1 0 13 matrix @日济大学 TONGJI UNIVERSITY
MATLAB Basics(3/40) Variables and Arrays ➢ The fundamental unit of data is array 3 scalar 1 -3 11 vector 15 -2 3 21 -4 1 0 13 matrix row column

MATLAB Basics(4/40) Variables and Arrays >Three common ways to initialize a variable in the MATLAB Assign data to the variable in an assignment statement Input data into the variable from the keyboard ·Read data from a file CDHAW 同你大学 TONGJI UNIVERSITY
MATLAB Basics(4/40) Variables and Arrays ➢ Three common ways to initialize a variable in the MATLAB • Assign data to the variable in an assignment statement • Input data into the variable from the keyboard • Read data from a file

MATLAB Basics(5/40) Variables and Arrays Initialization using assignment statements 。X=5 X= 5 。y=x+1 y= 6 ·vector=[1234] vector 1234 @日济大学 TONGJI UNIVERSITY
MATLAB Basics(5/40) Variables and Arrays ➢ Initialization using assignment statements • x = 5 x = 5 • y = x + 1 y = 6 • vector = [ 1 2 3 4 ] vector = 1 2 3 4

MATLAB Basics(6/40) Variables and Arrays ·matrix=[123,456] matrix 123 456 ·matrix=[123;45] ??Error ·a=[5(2+4)] a= CDHAW 56 @月诱大学 TONGJI UNIVERSITY
MATLAB Basics(6/40) Variables and Arrays • matrix = [ 1 2 3; 4 5 6 ] matrix = 1 2 3 4 5 6 • matrix = [ 1 2 3; 4 5 ] ??? Error • a = [ 5 (2+4) ] a = 5 6

MATLAB Basics(7/40) Variables and Arrays > Initialization using shortcut statements colon operator->first increment last ·x=1:2:10 X= 13579 °y=0:0.1:0.5 y= 00.10.20.30.40.5 @日济大学 TONGJI UNIVERSITY
MATLAB Basics(7/40) Variables and Arrays ➢ Initialization using shortcut statements ✓ colon operator → first : increment : last • x = 1:2:10 x = 1 3 5 7 9 • y = 0:0.1:0.5 y = 0 0.1 0.2 0.3 0.4 0.5

MATLAB Basics(8/40) Variables and Arrays √transpose operator→' ·u=[1:3] U= 1 2 v=[uu] 11 2 2 3 ·V= u] CDHAW V= 1 2 3 @月诱大学 TONGJI UNIVERSITY 123
MATLAB Basics(8/40) Variables and Arrays ✓ transpose operator → ’ • u = [ 1:3 ]' u = 1 2 3 • v = [ u u ] v = 1 1 2 2 3 3 • v = [ u'; u' ] v = 1 2 3 1 2 3

MATLAB Basics(9/40) Variables and Arrays Initialization using built-in functions √ zeros()ones() √size)length() ·x=zeros(2) y=ones(size(x)) X- y= 00 11 00 11 ·z=ones(2,3) ·t=zeros(length(z)) t= 111 0 0 0 111 0 0 0 0 0 0 LENGTH(X)returns the length of vector X. It is equivalent to MAX(SIZE(X))for non- 同濟大学 TONGJI UNIVERSITY empty arrays and 0 for empty ones
MATLAB Basics(9/40) Variables and Arrays ➢ Initialization using built-in functions ✓ zeros() ones() • x = zeros(2) x = 0 0 0 0 • z = ones(2,3) z = 1 1 1 1 1 1 ✓ size() length() • y = ones(size(x)) y = 1 1 1 1 • t = zeros( length(z) ) t = 0 0 0 0 0 0 0 0 0 LENGTH(X) returns the length of vector X. It is equivalent to MAX(SIZE(X)) for nonempty arrays and 0 for empty ones
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 01 MATLAB Programming for Mechanical Engineering(Introduction to MATLAB).ppt
- 同济大学:《Matlab在机械设计中的应用》课程教学资源(试卷习题)Final Examination(B)The First Semester(2013-2014).pdf
- 同济大学:《Matlab在机械设计中的应用》课程教学资源(试卷习题)Final Examination(A)The First Semester(2013-2014).pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第6章 齿轮.pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第2章 平面机构的结构分析.pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第8章 其他常见机构.pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第9章 机械中的摩擦与效率.pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第5章 凸轮机构.pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第10章 机械的平衡.pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第7章 轮系(Gear Train).pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第3章 平面机构的运动分析(Kinematic Analysis).pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第4章 平面四杆机构.pdf
- 运城学院:《机械原理》课程教学资源(课件讲稿)第1章 绪论(负责人:倪娟).pdf
- 运城学院:《机械原理》课程教学资源(教案讲义)第1章 绪论(打印版).pdf
- 运城学院:《机械原理》课程教学资源(教案讲义)第9章 机械中的摩擦和效率.doc
- 运城学院:《机械原理》课程教学资源(教案讲义)第8章 其他常用机构.doc
- 运城学院:《机械原理》课程教学资源(教案讲义)第11章 机械系统运动方案的设计.doc
- 运城学院:《机械原理》课程教学资源(教案讲义)第10章 机械的平衡.doc
- 运城学院:《机械原理》课程教学资源(教案讲义)第6章 齿轮机构.doc
- 运城学院:《机械原理》课程教学资源(教案讲义)第3章 平面机构的运动分析.doc
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 03Top-down and bottom-up design.ppt
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 04 Branches and Loops.ppt
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 05 Plotting.ppt
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 06 User-defined Functions.ppt
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 07 Sparse Arrays, Cell Arrays, and Structures.ppt
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 08 Advanced Mathematics.ppt
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 09 Probability and statistics.ppt
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 10 Graphical User Interface.ppt
- 同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 11 Simulink.pptx
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第一章 内燃机工作原理及总体构造 The Working Principles and Overall Structure of Internal Combustion Engines.pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第二章 机体组及曲柄连杆机构 Engine Block, Crank and Connecting Rod Mechanism.pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第三章 配气机构 Valve Trains(负责人:李理光).pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第四章 汽油机燃油供给系统 Fuel Supply System For Gasoline Engine.pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第六章 进气、排气及增压系统 Intake, Exhaust and Boost Systems.pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第五章 柴油机燃油供给系统 Fuel Supply System for Diesel Engines.pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第七章 发动机冷却系 Cooling System.pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第九章 起动系统 Starting System.pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第八章 发动机润滑系 Lubrication System for Automotive Engines.pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第十章 发动机点火系统 Engine Ignition System.pdf
- 同济大学:《汽车构造》课程电子教案(课件讲稿)第十二章 发动机有害排放物的控制系统 Control System of Harmful Emissions in Engine Exhaust.pdf