1、命令输入
1、Cleaning Up
clear Clears variables from the workspace.
clc Clears the Command Window and moves the cursor to the upper left corner of the window.
2、format
>> format long
Task 2 ✔
>> 13/6
ans =
2.166666666666667
Task 3 ✔
>> format bank
Task 4 ✔
>> 13/6
ans =
2.17
>> format short
>> 13/6
ans =
2.1667
>> help format

3 导入、另存数据文件

4 获取帮助
You can enter
doc fcnName
to get information on any MATLAB function.
5 创建向量
5.1 Create a Row Vector
Use square brackets and separate the values using a comma or a space.
Example
a = [10 15 20 25]
a =
10 15 20 25
Create a Column Vector
Use square brackets and separate the values using a semi-colon.
Example
b = [2;3;5;7]
b =
2
3
5
7
Transpose a Vector
Use the transpose operator '.
Example
c = b’
c =
2 3 5 7
Create a Matrix
Use square brackets and enter values row-by-row. Separate values in a row using a comma or a space, and use a semicolon to start a new row.
Example
A = [1 3 5;2 4 6]
A =
1 3 5
2 4 6
5.2 Creating Evenly-Spaced Vectors
Suppose you want to create a vector containing every integer from 1 to 10. You’ll need to type every number from 1 through 10.
v = [1 2 3 4 5 6 7 8 9 10];
Now what if you want your vector to contain every integer from 1 to 25?
v = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25];
Creating long vectors by manually entering every value can be tedious. In this lesson, you’ll learn to create vectors containing evenly-spaced elements using more compact syntax that uses the colon operator (😃 and the function linspace.
5.3 冒号:操作符

5.4 Linsapce 行间距

6、串联阵列





7 阵列创建函数

本文介绍了MATLAB中的基本操作,如清除工作区、清理命令窗口、格式化数字显示、导入导出数据、创建和操作向量,包括行向量、列向量、矩阵以及使用冒号和linspace进行均匀间隔元素生成。通过实例演示了format命令的不同用法和向量操作技巧。

被折叠的 条评论
为什么被折叠?



