MATLAB命令大全
MATLAB数值计算计算和数据可视化是一个交互式程序。您可以输入它的MATLAB提示符“>>”命令窗口中键入命令。
管理会话的命令
MATLAB提供会话管理的各种命令。
提供了所有这样的命令:
命令 目的/作用
clc 清除命令窗口。
clear 从内存中删除变量。
exist 检查存在的文件或变量。
global 声明变量为全局。
help 搜索帮助主题。
lookfor 搜索帮助关键字条目。
quit 停止MATLAB。
who 列出当前变量。
whos 列出当前变量(长显示)。
使用系统命令
MATLAB提供各种有用的命令与系统工作,在工作区中当前的工作,如保存为一个文件,并加载文件。
它还提供了其他系统相关的活动,如各种命令,显示日期,列出目录中的文件,显示当前目录等。
下表显示了一些常用的系统相关的命令:
命令 目的/作用
cd 改变当前目录。
date 显示当前日期。
delete 删除一个文件。
diary 日记文件记录开/关切换。
dir 列出当前目录中的所有文件。
load 负载工作区从一个文件中的变量。
path 显示搜索路径。
pwd 显示当前目录。
save 保存在一个文件中的工作区变量。
type 显示一个文件的内容。
what 列出所有MATLAB文件在当前目录中。
wklread 读取.wk1电子表格文件。
输入和输出命令
MATLAB提供了以下输入和输出相关的命令:
命令 作用/目的
disp 显示一个数组或字符串的内容。
fscanf 阅读从文件格式的数据。
format 控制屏幕显示的格式。
fprintf 执行格式化写入到屏幕或文件。
input 显示提示并等待输入。
; 禁止显示网版印刷
fscanf和fprintf命令的行为像C scanf和printf函数。他们支持格式如下代码:
格式代码 目的/作用
%s Format as a string.
%d Format as an integer.
%f Format as a floating yiibai value.
%e Format as a floating yiibai value in scientific notation.
%g Format in the most compact form: %f or %e.
Insert a new line in the output string.
Insert a tab in the output string.
用于数字显示格式的函数有以下几种形式:
Format函数 最多可显示
format short Four decimal digits (default).
format long 16 decimal digits.
format short e Five digits plus exponent.
format long e 16 digits plus exponents.
format bank Two decimal digits.
format + Positive, negative, or zero.
format rat Rational approximation.
format compact Suppresses some line feeds.
format loose Resets to less compact display mode.
向量,矩阵和阵列命令
下表列出了各种命令用于工作数组,矩阵和向量:
命令 作用/目的
cat Concatenates arrays.
find Finds indices of nonzero elements.
length Computes number of elements.
linspace Creates regularly spaced vector.
logspace Creates logarithmically spaced vector.
max Returns largest element.
min Returns smallest element.
prod Product of each column.
reshape Changes size.
size Computes array size.
sort Sorts each column.
sum Sums each column.
eye Creates an identity matrix.
ones Creates an array of ones.
zeros Creates an array of zeros.
cross Computes matrix cross products.
dot Computes matrix dot products.
det Computes determinant of an array.
inv Computes inverse of a matrix.
pinv Computes pseudoinverse of a matrix.
rank Computes rank of a matrix.
rref Computes reduced row echelon form.
cell Creates cell array.
celldisp Displays cell array.
cellplot Displays graphical representation of cell array.
num2cell Converts numeric array to cell array.
deal Matches input and output lists.
iscell Identifies cell array.
绘图命令
MATLAB提供了大量的命令,绘制图表。下表列出了一些常用的命令绘制:
命令 作用/目的
axis Sets axis limits.
fplot Intelligent plotting of functions.
grid Displays gridlines.
plot Generates xy plot.
print Prints plot or saves plot to a file.
title Puts text at top of plot.
xlabel Adds text label to x-axis.
ylabel Adds text label to y-axis.
axes Creates axes objects.
close Closes the current plot.
close all Closes all plots.
figure Opens a new figure window.
gtext Enables label placement by mouse.
hold Freezes current plot.
legend Legend placement by mouse.
refresh Redraws current figure window.
set Specifies properties of objects such as axes.
subplot Creates plots in subwindows.
text Places string in figure.
bar Creates bar chart.
loglog Creates log-log plot.
polar Creates polar plot.
semilogx Creates semilog plot. (logarithmic abscissa).
semilogy Creates semilog plot. (logarithmic ordinate).
stairs Creates stairs plot.
stem Creates stem plot.
相关文章
- matlab 受约束的 Delaunay 三角剖分
- 多微网优化调度(风机、光伏、蓄电池、燃料电池、柴油机、电网交互)(Matlab代码实现)
- 电力系统潮流【牛顿-拉夫逊法】(4节点、5节点、6节点、9节点)(Matlab代码实现)
- 【Bi-LSTM】基于双向长短期记忆 (Bi-LSTM) 需求预测研究(Matlab代码实现)
- 一种面向多通道系统的滤波x仿射投影符号算法(Matlab代码实现)
- 【状态估计】观测信号(包括异常值)的状态估计方法(Matlab代码实现)
- 基于MATLAB中雷达和视觉合成数据的目标级传感器融合(Matlab代码实现)
- 粒子滤波算法(Matlab代码实现)
- 【MATLAB】信号与系统 — 信号的相乘
- 【MATLAB】matlab遗传算法工具使用
- 【MATLAB】load 命令处理 .bat 文件获取数据
- 【MATLAB】插值计算
- 【MATLAB】MATLAB 仿真 — 基于matlab的QPSK系统仿真
- m半分布式JAC联合接纳控制与用户位置信息的垂直切换matlab仿真
- 基于ORL人脸数据库和PCA特征降维算法的人脸识别matlab仿真
- 【MATLAB】matlab 文档使用 ( 文档查询 | 文档层次 | 自带搜索工具 | 帮助命令 | 学习导引 )
- 【MATLAB】数据类型 ( 执行代码 | 清空命令 | 注释 | 数字 | 字符 | 字符串 )
- Matlab旅程(完整版)
- 基于基于全局差错能量函数的双目图像立体匹配算法matlab仿真,并提取图像的深度信息