matlab 基础入门 · 2018-01-15 · finance & economics government biotech, medical, &...

60
1 © 2017 The MathWorks, Inc. MATLAB 基础入门 MathWorks 中国

Upload: others

Post on 06-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

1© 2017 The MathWorks, Inc.

MATLAB 基础入门

MathWorks 中国

Page 2: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

2

主要内容

▪ MATLAB 介绍

▪ MATLAB 基础操作

▪ MATLAB 应用实例

▪ MATLAB 学习资源扫描二维码

获取讲座资料

MATLAB

Page 3: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

3

MATLAB 介绍

Page 4: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

4

MATLAB 是什么?

MATLAB®是一种用于算法开发、数据可视化、数据分析以及数值计算的科学计算语言和

编程环境。全球数以百万计的工程师和科学家使用 MATLAB®来分析和设计可改变世界的系统和

产品。

MATLAB是工程师和科学家最易用、并且最高效的开发平台

Page 5: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

5

Education

Aerospace & defense

Signal processing & communications

Utilities & energy

Finance & economics

Government

Biotech, medical, & pharmaceutical

Instrumentation

Automotive

MATLAB 应用领域

Page 6: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

6

Kalman Filter

Predicted state and covariance

Estimation

Estimated state and covariance

Estimated measurements

1. MATLAB 精通数学

Page 7: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

7

Files

Software

Hardware

Access

Code & Applications

Reporting and

Documentation

Outputs for Design

Deployment

Share

2. MATLAB 为工程师和科学家设计

Page 8: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

8

3. MATLAB 工具箱得心应手

Page 9: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

9

4. MATLAB 具有交互式应用

Page 10: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

10

VHDL/Verilog

C, C++

PLC

1000+ 款硬件器件

自动代码生成

5. MATLAB 集成工作流程

Page 11: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

11

快速3D 数据并行计算

6. MATLAB 迅速高效

Page 12: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

12

每天 100 - 200 万次测试

7. MATLAB 备受信任

Page 13: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

13

MATLAB 基础操作

Page 14: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

14

MATLAB 用户界面

MATLAB工具栏

显示MATLAB当前路径

MATLAB的当前目录,可以点击查看目录内的文件或切换到其他目录

MATLAB命令窗口,可以运行命令并查看结果

MATLAB工作空间,可以查看内存中的

变量

快捷方式工具条

Page 15: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

15

Array(数组):

包含多个值的变量(任意长度,任意维度)

Matrix(矩阵):

数值型 2-D array (m-by-n)

Vector(向量):

1-D array (1-by-n or m-by-1)

Scalar(标量):

单个值

MATLAB 中的数据结构

Page 16: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

16

分类型 函数句柄型 逻辑型

数值型时间型 异构型和字符型

MATLAB 中的数据类型

Page 17: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

17

19 13 7 11 2 17 5 3

19

13

7

11

2

17

5

3

>> x = [19 13 7 11 2 17 5 3]

>> x = [19;13;7;11;2;17;5;3]

MATLAB 创建数组

▪ 手动输入

▪ 函数生成 linspace, ones, zeros, eye

rand, randi, randn, magic, ……

>> x = a:dx:b

[a a+dx a+2dx … a+mdx], a+mdx<=b

Page 18: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

18

MATLAB 矩阵计算

▪ 矩阵化的数据索引

Page 19: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

19

*

m-by-n n-by-p m-by-p

▪ 矩阵乘法

MATLAB 矩阵计算

Page 20: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

20

▪ 矩阵点乘法

MATLAB 矩阵计算

Page 21: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

21

▪ 向量化操作的内置函数

MATLAB 矩阵计算

元素运算 向量运算

Page 22: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

22

示例演示

▪ 矩阵与数组– MATLAB 帮助文档 > Getting Started > Matrices and Array

Page 23: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

23

✓ Automatic code

数据绘图

Page 24: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

24

surf(z)

数据可视化

surf surfl surfc contour3

mesh meshz waterfall contour

Page 25: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

25

Axis labels -2Units -1

4/10

更改属性

选择绘制组件添加绘制元素

绘图工具

Page 26: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

26

示例演示

▪ 2D 和 3D 绘图– MATLAB 帮助文档 > Getting Started > 2-D and 3-D Plots

Page 27: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

27

MATLAB 命令行

检索重用

Page 28: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

28

MATLAB 脚本编辑器

Page 29: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

29

MATLAB 实时编辑器

https://www.mathworks.com/videos/using-the-live-editor-116936.html

Page 30: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

30

MATLAB 编程

▪ 判断分支

Page 31: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

31

MATLAB 编程

▪ 循环

for-loops 遍历

while-

loops条件判断

Page 32: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

32

为什么要用函数?

script1.m script2.mWorkspace

管理代码管理变量

Page 33: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

33

MATLAB 函数

42

0.7623

foo.m

BlackBox™

Page 34: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

34

示例演示

▪ 脚本与函数– MATLAB 帮助文档 > Programming Scripts and Functions > Programming Basics

> Scripts vs. Functions

▪ 实时脚本– MATLAB 帮助文档 > Programming Scripts and Functions > Programming Basics

> Create Live Scripts

Page 35: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

35

MATLAB 应用实例

Page 36: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

36

>> appdesigner

1. App Designer

Page 37: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

37

App Designer 开发流程

1. 在设计视图添加图形布局

2. 设置组件属性

3. 创建并实现回调

Page 38: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

38

设计视图

组件库 画板

组件浏览器

组件属性

Page 39: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

39

代码视图

组件浏览器

组件属性App 层次图

代码浏览器

App 代码

Page 40: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

40

示例演示

▪ 创建一个图形 App– MATLAB 帮助文档 > App Building > App Designer > App Building Basics >

Create a Simple App Using App Designer

– https://cn.mathworks.com/videos/app-designer-117921.html

Page 41: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

41

2. MATLAB数据分析

航空

医疗设备

非公路汽车

汽车

石油天然气

工业自动化

车队分析

健康监测分析

资产分析

过程分析

预测分析 状态监测分析

清洁能源

零售分析

制造过程分析

供应链分析

运营分析

健康管理分析

风险分析

物流

零售

金融

健康管理

互联网

铁路

Page 42: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

42

为什么需要数据分析?

• 发生了什么?描述

• 为什么会发生?诊断

• 将会发生什么?预测

• 应该做什么?规范

将大量复杂数据转化为可操作的信息

数据 决策

Page 43: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

43

MATLAB 令数据分析变得简单

分析结果分享与实现

桌面 Apps

企业级系统集成

嵌入式系统与硬件

文件

数据库

传感器

数据获取与探索 开发预测模型

数学建模

模型验证

参数优化

数据预处理

处理散乱的数据

数据压缩与转换

特征提取

Page 44: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

44

数据分析与探索

▪ 选择并点击多个工具可直接获取

各类数据源

▪ 高性能大数据环境

文件

信号

数据库

图像

▪ 利用内置的数据预处理算法,获取

传感器、图像、音频、视频等实时

数据

MATLAB 支持商用数据和工程数据

1

文件

数据库

传感器

数据获取与探索

Page 45: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

45

数据处理与模型开发

MATLAB 协助各领域专家从容应对数据科学

2

Apps 代码

▪ Apps 简单易用

▪ 广泛领域的工具,以方便特定领域

的分析

▪ 案例和视频协助快速入门

▪ MATLAB 代码自动生成

▪ 大数据高速运算

数据预处理

处理散乱的数据

数据压缩与转换

特征提取

开发预测模型

数学建模

模型验证

参数优化

Page 46: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

46

应用发布与部署

▪ 选择并点击实现部署

▪ 桌面和服务器应用统一的实现过程

MATLAB 分析应用可以在任一平台运行

3分析结果分享与部署

桌面 Apps

企业级系统集成

嵌入式系统与硬件

Page 47: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

47

示例演示

▪ 使用 timetable 处理带有时间戳的数据– MATLAB 帮助文档 > Examples > Language Fundamentals > Preprocess and

Explore Time-stamped Data using timetable

▪ Machine Learning with MATLAB Overview– https://cn.mathworks.com/videos/machine-learning-with-matlab-87051.html

Page 48: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

48

3. 工具箱应用示例

▪ Symbolic Math Toolbox– MATLAB 帮助文档 > Symbolic Math Toolbox > Examples > Computational

Mathematics in Symbolic Math Toolbox

▪ Image Processing Toolbox– MATLAB 帮助文档 > Image Processing Toolbox > Examples > Image

Segmentation > Detecting a Cell Using Image Segmentation

▪ Neural Network Toolbox– MATLAB 帮助文档 > Neural Network Toolbox > Getting Started > Tutorials > Try

Deep Learning in 10 Lines of MATLAB Code

▪ …

Page 49: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

49

MATLAB 学习资源

Page 50: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

50

玩转帮助文档

help

doc

docsearch

search

browse

Page 51: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

51

资源宝藏:MathWorks 官网

▪ www.mathworks.com, cn.mathworks.com

▪ 注册 MathWorks 账户

▪ 关联全校板 License

Page 52: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

52

MATLAB 产品主页

Page 53: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

53

学术类资源

Page 54: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

54

交互式免费课程

Page 55: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

55

免费教程 – MATLAB Onramp

Page 56: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

56

免费教程 – MATLAB Onramp

Page 57: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

57

视频与网上研讨会

Page 58: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

58

答疑解惑:用户社区

Page 59: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

59

现在就开始学习与使用MATLAB!

▪ MATLAB Academy – 通过2小时互动式的课程自学MATLAB

▪ MATLAB Online - 通过Web浏览器使用网页版MATLAB。

▪ 录制的在线研讨会和视频 – 通过视频学习MATLAB&Simulink在不同应用领域的强大产品功能

▪ MATLAB 示例 – 包含丰富的示例供教学和研究使用

▪ 更多免费资源,请激活您的账号后通过TAH Resource Kit获取

Page 60: MATLAB 基础入门 · 2018-01-15 · Finance & economics Government Biotech, medical, & pharmaceutical Instrumentation Automotive MATLAB 应用领域. 6 Kalman Filter Predicted state

60© 2017 The MathWorks, Inc.

MATLAB

扫描二维码,

获取讲座资料