当前位置:文档之家› Matlab命令和函数总结(MATLAB Commands and Functions)

Matlab命令和函数总结(MATLAB Commands and Functions)

Matlab命令和函数总结(MATLAB Commands and Functions)
Matlab命令和函数总结(MATLAB Commands and Functions)

MATLAB Commands and Functions

Dr. Brian Vick

Mechanical Engineering Department

Virginia Tech

General Purpose Commands

Operators and Special Characters / 3

Commands for Managing a Session / 3

Special Variables and Constants / 4

System and File Commands / 4

Input/Output and Formatting Commands

Input/Output Commands / 5

Format Codes for fprintf and fscanf / 5

Numeric Display Formats / 5

Vector, Matrix and Array Commands

Array Commands / 6

Special Matrices / 6

Matrix Arithmetic / 6

Matrix Commands for Solving Linear Equations / 6

Cell Array Functions / 7

Structure Functions / 7

Plotting Commands

Basic xy Plotting Commands / 8

Plot Enhancement Commands / 8

Specialized Plot Commands / 8

Colors, Symbols and Line Types / 9

Three-Dimensional Plotting Commands / 9

Histogram Functions / 9

Programming

Logical and Relational Operators / 10

Program Flow Control / 10

Logical Functions / 10

M-Files / 11

Timing /11

Mathematical Functions

Exponential and Logarithmic Functions / 12

Trigonometric Functions / 12

Hyperbolic Functions / 12

Complex Functions / 13

Statistical Functions / 13

Random Number Functions / 13

Numeric Functions / 13

String Functions / 13

Numerical Methods

Polynomial and Regression Functions / 14

Interpolation Functions / 14

Numerical Integration Functions / 14

Numerical Differentiation Functions / 14

ODE Solvers / 15

Predefined Input Functions / 15

Symbolic Math Toolbox

Functions for Creating and Evaluating Symbolic Expressions / 16

Functions for Manipulating Symbolic Expressions / 16

Symbolic Calculus Functions / 16

Symbolic Solution of Algebraic and Transcendental Equations / 17 Symbolic Solution of Differential Equations / 17

Laplace Transform Functions / 17

Symbolic Linear Algebra Functions / 17

General Purpose Commands

Operators and Special Characters

+Plus; addition operator.

-Minus; subtraction operator.

*Scalar and matrix multiplication operator.

.*Array multiplication operator.

^Scalar and matrix exponentiation operator.

.^Array exponentiation operator.

\Left-division operator.

/Right-division operator.

.\Array left-division operator.

./Array right-division operator.

:Colon; generates regularly spaced elements and represents an entire row or column. ( )Parentheses; encloses function arguments and array indices; overrides precedence. [ ]Brackets; enclosures array elements.

.Decimal point.

…Ellipsis; line-continuation operator.

,Comma; separates statements and elements in a row.

;Semicolon; separates columns and suppresses display.

%Percent sign; designates a comment and specifies formatting.

_Quote sign and transpose operator.

._Nonconjugated transpose operator.

=Assignment (replacement) operator.

Commands for Managing a Session

clc Clears Command window.

clear Removes variables from memory.

exist Checks for existence of file or variable.

global Declares variables to be global.

help Searches for a help topic.

lookfor Searches help entries for a keyword.

quit Stops MATLAB.

who Lists current variables.

whos Lists current variables (long display).

System and File Commands

cd Changes current directory.

date Displays current date.

delete Deletes a file.

diary Switches on/off diary file recording.

dir Lists all files in current directory.

load Loads workspace variables from a file.

path Displays search path.

pwd Displays current directory.

save Saves workspace variables in a file.

type Displays contents of a file.

what Lists all MATLAB files in the current directory. wklread Reads .wk1 spreadsheet file.

Input/Output and Formatting Commands

Input/Output Commands

disp Displays contents of an array or string.

fscanf Read formatted data from a file.

format Controls screen-display format.

fprintf Performs formatted writes to screen or file.

input Displays prompts and waits for input.

;Suppresses screen printing.

Format Codes for fprintf and fscanf

%s Format as a string.

%d Format as an integer.

%f Format as a floating point value.

%e Format as a floating point value in scientific notation. %g Format in the most compact form: %f or %e.

\n Insert a new line in the output string.

\t Insert a tab in the output string.

Numeric Display Formats

format short Four decimal digits (default).

format long16 decimal digits.

format short e Five digits plus exponent.

format long e16 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.

Vector, Matrix and Array Commands

Array Commands

cat Concatenates arrays.

find Finds indices of nonzero elements. length Computers 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 Change size

size Computes array size.

sort Sorts each column.

sum Sums each column.

Special Matrices

eye Creates an identity matrix.

ones Creates an array of ones.

zeros Creates an array of zeros.

Matrix Arithmetic

cross Computes cross products.

dot Computes dot products.

Matrix Commands for Solving Linear Equations 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 Array Functions

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.

Structure Functions

fieldnames Returns field names in a structure array. getfield Returns field contents of a structure array. isfield Identifies a structure array field.

isstruct Identifies a structure array.

rmfield Removes a field from a structure array. setfield Sets contents of field.

struct Creates structure array.

Plotting Commands

Basic xy Plotting Commands

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.

Plot Enhancement Commands

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.

Specialized Plot Commands

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 pot.

stem Creates stem plot.

Colors, Symbols and Line Types

Color Symbol Line

y yellow.point-solid

m magenta o circle:dotted

c cyan x x-mark-.dash dotte

d r red+plus--dashed

g green*star

b blue d diamond

w white v triangle (down)

k black^triangle (up)

>triangle (right)

p pentagram

h hexagram

Three-Dimensional Plotting Commands

contour Creates contour plot.

mesh Creates three-dimensional mesh surface plot.

meshc Same as mesh with contour plot underneath.

meshz Same as mesh with vertical lines underneath.

plot3Creates three-dimensional plots from lines and points.

surf Creates shaded three-dimensional mesh surface plot.

surfc Same as surf with contour plot underneath.

meshgrid Creates rectangular grid.

waterfall Same as mesh with mesh lines in one direction.

zlabel Adds text label to z-axis.

Histogram Functions

bar Creates a bar chart.

hist Aggregates the data into equally spaced bins.

histc Aggregates the data into unequally spaced bins.

Programming

Logical and Relational Operators

==Relational operator: equal to.

~=Relational operator: not equal to.

<=Relational operator: less than or equal to.

>Relational operator: greater than.

>=Relational operator: greater than or equal to.

&Logical operator: AND.

|Logical operator: OR.

~Logical operator: NOT.

xor Logical operator: EXCLUSIVE OR.

Program Flow Control

break Terminates execution of a loop.

case Provides alternate execution paths within switch structure.

else Delineates alternate block of statements.

elseif Conditionally executes statements.

end Terminates for, while, and if statements.

error Display error messages.

for Repeats statements a specific number of times

if Executes statements conditionally.

otherwise Default part of switch statement.

return Return to the invoking function.

switch Directs program execution by comparing point with case expressions. warning Display a warning message.

while Repeats statements an indefinite number of times.

Logical Functions

any True if any elements are nonzero.

all True if all elements are nonzero.

find Finds indices of nonzero elements.

finite True if elements are finite.

isnan True if elements are undefined.

isinf True if elements are infinite.

isempty True if matrix is empty.

isreal True if all elements are real.

M-Files

eval Interpret strings containing Matlab expressions. feval Function evaluation.

function Creates a user-defined function M-file.

global Define global variables.

nargin Number of function input arguments. nargout Number of function output arguments.

script Script M-files

Timing

cputime CPU time in seconds.

clock Current date and time as date vector.

tic, toc Start, stop a stopwatch timer.

Mathematical Functions

Trigonometric Functions

acos(x)Inverse cosine; arcos x = cos –1 (x). acot(x)Inverse cotangent; arccot x = cot –1(x). acsc(x)Inverse cosecant; arcs x = csc –1 (x). asec(x)Inverse secant; arcsec x = sec –1 (x). asin(x)Inverse sine; arcsin x = sin –1 (x).

atan(x)Inverse tangent; arctan x = tan –1 (x). atan2(y,x)Four-quadrant inverse tangent.

cos(x)Cosine; cos(x).

cot(x)Cotangent; cot(x).

csc(x)Cosecant; csc(x).

sec(x)Secant; sec(x).

sin(x)Sine; sin(x).

tan(x)Tangent; tan(x).

Hyperbolic Functions

acosh(x)Inverse hyperbolic cosine; cosh –1 (x). acoth(x)Inverse hyperbolic cotangent; coth –1 (x). acsch(x)Inverse hyperbolic cosecant; csch –1 (x). asech(x)Inverse hyperbolic secant; sech –1 (x). asinh(x)Inverse hyperbolic sine; sinh –1 (x). atanh(x)Inverse hyperbolic tangent; tanh –1 (x). cosh(x)Hyperbolic cosine; cosh(x).

coth(x)Hyperbolic cotangent; cosh(x)/sinh(x). csch(x)Hyperbolic cosecant; 1/sinh(x).

sech(x)Hyperbolic secant; 1/cosh(x).

sinh(x)Hyperbolic sine; sinh(x).

tanh(x)Hyperbolic tangent; sinh(x)/cosh(x).

Complex Functions

abs(x)Absolute value; |x|.

angle(x)Angle of a complex number x.

conj(x)Complex conjugate of x.

imag(x)Imaginary part of a complex number x.

real(x)Real part of a complex number x.

Statistical Functions

erf(x)Computes the error function erf (x).

mean Calculates the average.

median Calculates the median.

std Calculates the standard deviation.

Random Number Functions

rand Generates uniformly distributed random numbers between 0 and 1. randn Generates normally distributed random numbers.

Numeric Functions

ceil Rounds to the nearest integer toward ?.

fix Rounds to the nearest integer toward zero.

floor Rounds to the nearest integer toward - ?.

round Rounds towards the nearest integer.

sign Signum function.

String Functions

findstr Finds occurrences of a string.

strcmp Compares strings.

char Creates character string array

Numerical Methods

Polynomial and Regression Functions

conv Computes product of two polynomials

deconv Computes ratio of polynomials.

eig Computes the eigenvalues of a matrix.

poly Computes polynomial from roots.

polyfit Fits a polynomial to data.

polyval Evaluates polynomial and generates error estimates.

roots Computes polynomial roots.

Interpolation Functions

interp1Linear and cubic-spline interpolations of a function of one variable.

interp2Linear interpolation of a function of two variables.

spline Cubic-spline interpolation.

unmkpp Computes the coefficients of cubic-spine polynomials.

Root Finding and Minimization

fmin Finds minimum of single-variable function.

fmins Finds minimum of multivariable function.

fzero Finds zero of single-variable function.

Numerical Integration Functions

quad Numerical integration with adaptive Simpson’s rule.

quadl Numerical integration with adaptive Lobatto quadrature.

trapz Numerical integration with the trapezoidal rule.

Numerical Differentiation Functions

diff(x)Computes the difference between adjacent elements in the vector x. polyder Differentiates a polynomial, a polynomial product, or a polynomial quotient.

ODE Solvers

ode23Nonstiff, low-order solver.

ode45Nonstiff, medium-order solver.

ode113Nonstiff, variable-order solver.

ode23s Stiff, low-order.

ode23t Moderately stiff, trapezoidal rule solver.

ode23b Stiff, low-order solver.

ode15s Stiff, variable-order solver.

odeset Creates integrator options structure for ODE solvers.

Predefined Input Functions

gensig Generates a periodic sine, square, or pulse input. sawtooth Generates a periodic sawtooth input.

square Generates a square wave input.

stepfun Generates a step function input.

Symbolic Math Toolbox

Functions for Creating and Evaluating Symbolic Expressions

class Returns the class of an expression.

digits Sets the number of decimal digits used to do variable precision arithmetic. double Converts an expression to numeric form.

ezplot Generates a plot of a symbolic expression.

findsym Finds the symbolic variables in a symbolic expression.

numden Returns the numerator and denominator of an expression.

sym Creates a symbolic variable.

syms Creates one or more symbolic variables.

vpa Sets the number of digits used to evaluate expressions.

Functions for Manipulating Symbolic Expressions

collect Collects coefficients of like powers in an expression.

expand Expands an expression by carrying out jpowers.

factor Factors an expression.

poly2sym Converts a polynomial coefficient vector to a symbolic polynomial. pretty Displays an expression in a form that resembles typeset mathematics. simple Searches for the shortest form of an expression.

simplify Simplifies an expression using Maple’s simplification rules.

subs Substitutes variables or expressions.

sym2poly Converts an expression to a polynomial coefficient vector.

Symbolic Calculus Functions

diff Returns the derivative of an expression.

Dirac Dirac delta function (unit impulse).

Heaviside Heaviside function (unit step).

int Returns the integral of an expression.

limit Returns the limit of an expression.

symsum Returns the symbolic summation of an expression.

taylor Returns the Taylor series of a function.

Symbolic Solution of Algebraic and Transcendental Equations

solve Solves symbolic equations.

Symbolic Solution of Differential Equations

dsolve Returns a symbolic solution of a differential equation or set of equations.

Laplace Transform Functions

ilaplace Returns the inverse Laplace transform.

laplace Returns the Laplace transform.

Symbolic Linear Algebra Functions

det Returns the determinant of a matrix.

eig Returns the eigenvalues (characteristic roots) of a matrix.

inv Returns the inverse of a matrix.

poly Returns the characteristic polynomial of a matrix.

(完整版)MATLAB常用函数大全

一、MATLAB常用的基本数学函数 abs(x):纯量的绝对值或向量的长度 angle(z):复数z的相角(Phase angle) sqrt(x):开平方 real(z):复数z的实部 imag(z):复数z的虚部 conj(z):复数z的共轭复数 round(x):四舍五入至最近整数 fix(x):无论正负,舍去小数至最近整数 floor(x):地板函数,即舍去正小数至最近整数ceil(x):天花板函数,即加入正小数至最近整数rat(x):将实数x化为分数表示 rats(x):将实数x化为多项分数展开 sign(x):符号函数(Signum function)。 当x<0时,sign(x)=-1; 当x=0时,sign(x)=0; 当x>0时,sign(x)=1。 rem(x,y):求x除以y的馀数 gcd(x,y):整数x和y的最大公因数 lcm(x,y):整数x和y的最小公倍数 exp(x):自然指数 pow2(x):2的指数 log(x):以e为底的对数,即自然对数或 log2(x):以2为底的对数 log10(x):以10为底的对数 二、MATLAB常用的三角函数 sin(x):正弦函数 cos(x):余弦函数

tan(x):正切函数 asin(x):反正弦函数 acos(x):反馀弦函数 atan(x):反正切函数 atan2(x,y):四象限的反正切函数 sinh(x):超越正弦函数 cosh(x):超越馀弦函数 tanh(x):超越正切函数 asinh(x):反超越正弦函数 acosh(x):反超越馀弦函数 atanh(x):反超越正切函数 三、适用於向量的常用函数有: min(x): 向量x的元素的最小值 max(x): 向量x的元素的最大值 mean(x): 向量x的元素的平均值 median(x): 向量x的元素的中位数 std(x): 向量x的元素的标准差 diff(x): 向量x的相邻元素的差 sort(x): 对向量x的元素进行排序(Sorting)length(x): 向量x的元素个数 norm(x): 向量x的欧氏(Euclidean)长度sum(x): 向量x的元素总和 prod(x): 向量x的元素总乘积 cumsum(x): 向量x的累计元素总和cumprod(x): 向量x的累计元素总乘积 dot(x, y): 向量x和y的内积 cross(x, y): 向量x和y的外积 四、MATLAB的永久常数

MATLAB常用函数

MATLAB包括拥有数百个内部函数的主包和三十几种工具包。工具包又可以分为功能性工具包和学科工具包。功能工具包用来扩充MATLAB的符号计算,可视化建模仿真,文字处理及实时控制等功能。学科工具包是专业性比较强的工具包,控制工具包,信号处理工具包,通信工具包等都属于此类。 开放性使MATLAB广受用户欢迎。除内部函数外,所有MATLAB主包文件和各种工具包都是可读可修改的文件,用户通过对源程序的修改或加入自己编写程序构造新的专用工具包。 Matlab Main Toolbox——matlab主工具箱 Control System Toolbox——控制系统工具箱 Communication Toolbox——通讯工具箱 Financial Toolbox——财政金融工具箱 System Identification Toolbox——系统辨识工具箱 Fuzzy Logic Toolbox——模糊逻辑工具箱 Higher-Order Spectral Analysis Toolbox——高阶谱分析工具箱 Image Processing Toolbox——图象处理工具箱 LMI Control Toolbox——线性矩阵不等式工具箱 Model predictive Control Toolbox——模型预测控制工具箱 μ-Analysis and Synthesis Toolbox——μ分析工具箱 Neural Network Toolbox——神经网络工具箱 Optimization Toolbox——优化工具箱 Partial Differential Toolbox——偏微分方程工具箱 Robust Control Toolbox——鲁棒控制工具箱 Signal Processing Toolbox——信号处理工具箱 Spline Toolbox——样条工具箱 Statistics Toolbox——统计工具箱 Symbolic Math Toolbox——符号数学工具箱 Simulink Toolbox——动态仿真工具箱 Wavele Toolbox——小波工具箱

(完整版)matlab函数大全(非常实用)

信源函数 randerr 产生比特误差样本 randint 产生均匀分布的随机整数矩阵 randsrc 根据给定的数字表产生随机矩阵 wgn 产生高斯白噪声 信号分析函数 biterr 计算比特误差数和比特误差率 eyediagram 绘制眼图 scatterplot 绘制分布图 symerr 计算符号误差数和符号误差率 信源编码 compand mu律/A律压缩/扩张 dpcmdeco DPCM(差分脉冲编码调制)解码dpcmenco DPCM编码 dpcmopt 优化DPCM参数 lloyds Lloyd法则优化量化器参数 quantiz 给出量化后的级和输出值 误差控制编码 bchpoly 给出二进制BCH码的性能参数和产生多项式convenc 产生卷积码 cyclgen 产生循环码的奇偶校验阵和生成矩阵cyclpoly 产生循环码的生成多项式 decode 分组码解码器 encode 分组码编码器 gen2par 将奇偶校验阵和生成矩阵互相转换gfweight 计算线性分组码的最小距离 hammgen 产生汉明码的奇偶校验阵和生成矩阵rsdecof 对Reed-Solomon编码的ASCII文件解码rsencof 用Reed-Solomon码对ASCII文件编码rspoly 给出Reed-Solomon码的生成多项式syndtable 产生伴随解码表 vitdec 用Viterbi法则解卷积码 (误差控制编码的低级函数) bchdeco BCH解码器 bchenco BCH编码器 rsdeco Reed-Solomon解码器 rsdecode 用指数形式进行Reed-Solomon解码 rsenco Reed-Solomon编码器 rsencode 用指数形式进行Reed-Solomon编码 调制与解调

matlab 常用函数汇总

matlab 常用函数汇总 编程2008-07-10 21:45:20 阅读46 评论0 字号:大中小订阅matlab常用函数 图形注释 Title 图形标题 Xlabel X轴标记 Ylabel Y轴标记 Text 文本注释 Gtext 用鼠标放置文本 Grid 网格线 MATLAB编程语言 Function 增加新的函数 Eval 执行由MA TLAB表达式构成的字串 Feval 执行由字串指定的函数 Global 定义全局变量 程序控制流 If 条件执行语句 Else 与if命令配合使用 Elseif 与if命令配合使用 End For,while和if语句的结束 For 重复执行指定次数(循环) While 重复执行不定次数(循环) Break 终止循环的执行 Return 返回引用的函数 Error 显示信息并终止函数的执行 交互输入 Input 提示用户输入 Keyboard 像底稿文件一样使用键盘输入 Menu 产生由用户输入选择的菜单 Pause 等待用户响应 Uimenu 建立用户界面菜单 Uicontrol 建立用户界面控制 一般字符串函数 Strings MATLAB中有关字符串函数的说明 Abs 变字符串为数值 Setstr 变数值为字符串 Isstr 当变量为字符串时其值为真 Blanks 空串 Deblank 删除尾部的空串 Str2mat 从各个字符串中形成文本矩阵 Eval 执行由MA TLAB表达式组成的串 字符串比较 Strcmp , , , 比较字符串 Findstr 在一字符串中查找另一个子串

Upper 变字符串为大写 Lower 变字符串为小写 Isletter 当变量为字母时,其值为真 Isspace 当变量为空白字符时,其值为真 字符串与数值之间变换 Num2str 变数值为字符串 Int2str 变整数为字符串 Str2num 变字符串为数值 Sprintf 变数值为格式控制下的字符串 Sscanf 变字符串为格式控制下的数值 十进制与十六进制数之间变换 Hex2num 变十六进制为IEEE标准下的浮点数Hex2dec 变十六制数为十进制数 Dec2hex 变十进制数为十六进制数 建模 Append 追加系统动态特性 Augstate 变量状态作为输出 Blkbuild 从方框图中构造状态空间系统Cloop 系统的闭环 Connect 方框图建模 Conv 两个多项式的卷积 Destim 从增益矩阵中形成离散状态估计器Dreg 从增益矩阵中形成离散控制器和估计器Drmodel 产生随机离散模型 Estim 从增益矩阵中形成连续状态估计器Feedback 反馈系统连接 Ord2 产生二阶系统的A、B、C、D Pade 时延的Pade近似 Parallel 并行系统连接 Reg 从增益矩阵中形成连续控制器和估计器Rmodel 产生随机连续模型 Series 串行系统连接 Ssdelete 从模型中删除输入、输出或状态ssselect 从大系统中选择子系统 模型变换 C2d 变连续系统为离散系统 C2dm 利用指定方法变连续为离散系统 C2dt 带一延时变连续为离散系统 D2c 变离散为连续系统 D2cm 利用指定方法变离散为连续系统 Poly 变根值表示为多项式表示 Residue 部分分式展开 Ss2tf 变状态空间表示为传递函数表示 Ss2zp 变状态空间表示为零极点表示

MATLAB常用指令

MATLAB常用指令 1.常用命令-->管理命令和函数 addpath 添加目录到MATLAB搜索路径 doc 在Web浏览器上现实HTML文档 help 显示Matlab命令和M文件的在线帮助 helpwin helpdesk help lookfor 在基于Matlab搜索路径的所有M文件中搜索关键字partialpath 部分路径名 path 所有关于路径名的处理 pathtool 一个不错的窗口路径处理界面 rmpath 删除搜索路径中指定目录 type 显示指定文件的内容 ver 版本信息 version 版本号 web 打开web页 what 列出当前目录吓所有的M文件Mat文件和Mex文件whatsnew 显示readme文件 which 显示文件位置 (返回) 2.常用命令-->管理变量和工作区(输入输出、内存管理等) clear 从内存中删除 disp 显示文本或数组内容 length 数组长度(最长维数) load 重新载入变量(从磁盘上) mlock 锁定文件,防止文件被错误删除 munlock 解锁文件 openvar 在数组编辑器中打开变量 pack 整理内存空间 save 保存变量到文件8*) size 数组维数 who 列出内存变量 whos 列出内存变量,同时显示变量维数 workspace 显示工作空间窗口 (返回) 3.常用命令-->管理命令控制窗口(command窗口) clc 清空命令窗口 echo 禁止或允许显示执行过程 format 设置输出显示格式 home 光标移动到命令窗口左上角 more 设置命令窗口页输出格式 (返回)

matlab最常用函数

1、 基本形式 >> y=[0 0.58 0.70 0.95 0.83 0.25]; >> plot(y) 生成的图形是以序号为横坐标、数组y的数值为纵坐标画出的折线。 >> x=linspace(0,2*pi,30); % 生成一组线性等距的数值 >> y=sin(x); >> plot(x,y) 生成的图形是上30个点连成的光滑的正弦曲线。 多重线 在同一个画面上可以画许多条曲线,只需多给出几个数组,例如 >> x=0:pi/15:2*pi; >> y1=sin(x); >> y2=cos(x); >> plot(x,y1,x,y2) 则可以画出多重线。另一种画法是利用hold命令。在已经画好的图形上,若设置hold on,MATLA将把新的plot命令产生的图形画在原来的图形上。而命令hold off 将结束这个过程。例如: >> x=linspace(0,2*pi,30); y=sin(x); plot(x,y) >> hold on >> z=cos(x); plot(x,z) >> hold off 线型和颜色 MATLAB对曲线的线型和颜色有许多选择,标注的方法是在每一对数组后加一个字符串参数,说明如下: 线型线方式:- 实线:点线-. 虚点线- - 波折线。 线型点方式: . 圆点+加号* 星号x x形o 小圆

颜色:y黄;r红;g绿;b蓝;w白;k黑;m紫;c青. 以下面的例子说明用法: >> x=0:pi/15:2*pi; >> y1=sin(x); y2=cos(x); >> plot(x,y1,’b:+’,x,y2,’g-.*’) 网格和标记 在一个图形上可以加网格、标题、x轴标记、y轴标记,用下列命令完成这些工作。 >> x=linspace(0,2*pi,30); y=sin(x); z=cos(x); >> plot(x,y,x,z) >> grid >> xlabel(‘Independent Variable X’) >> ylabel(‘Dependent Variables Y and Z’) >> title(‘Sine and Cosine Curves’) 也可以在图形的任何位置加上一个字符串,如用: >> text(2.5,0.7,’sinx’) 表示在坐标x=2.5, y=0.7处加上字符串sinx。更方便的是用鼠标来确定字符串的位置,方法是输入命令: >> gtext(‘sinx’) 在图形窗口十字线的交点是字符串的位置,用鼠标点一下就可以将字符串放在那里。 坐标系的控制 在缺省情况下MATLAB自动选择图形的横、纵坐标的比例,如果你对这个比例不满意,可以用axis命令控制,常用的有: axis([xmin xmax ymin ymax]) [ ]中分别给出x轴和y轴的最大值、最小值 axis equal 或axis(‘equal’) x轴和y轴的单位长度相同 axis square 或axis(‘square’) 图框呈方形

Matlab作图函数的总结与分析

高等理科教育2005年第6期(总第64期)Matlab作图函数的总结与分析+ 黄琼湘那斯尔江?吐尔逊 (tfi疆大学数学与系统科学学院,新疆乌鲁木齐830046) 摘要Matlab(MATrixLABoratory的简称)是CleverMoler博士用Fortran语言开发的科学计算工具。它已成为科学研究、工程计算、应用开发的重要工具。国外已将它作为理工科大学的必修课程,国内各大学也开始开设这门课程。Matlab有强大的作图功能,有兴趣的读者可参考文献【卜4’。本文对Matlab的作图函数进行分析和总结,以供教学参考和学生学习之用。 关键词Matlab数据可视化作图函数 中图分类号G642.0文献标识码A 一、Matl如作图函数的总结 Matlab提供了丰富的作图函数,有100个之多。在教学和学习中显得有点杂乱。我们先对它们进行总结和分类,并提炼出它们的共性和特性。 Matlab的作图函数从视角的维数上分有三类:一维作图函数、二维作图函数和三维作图函数。它们的代表分别是line、plot和plot3等函数。从类型上分大致有四类:通用作图函数(如plot函数等);专业作图函数(如contour函数、quiver函数等);动画制作函数(如movie、comet3等函数);图形修饰函数(如view等函数)。 Matlab所有的作图函数都可以通过查帮助获得它的功能和用法。这里我们把作图函数按类型分类,列出一些主要和常用的作图函数(见表1),以抓住重点。 作图函数虽然功能不同,但它们的调用格式是一致的。我们用GraphF来表示一般的作图函数,它们的调用格式如下: 1.GraphF(X,Y,S) 这是一、二维函数的作图格式。x和Y表示图形的数据点,s表示图形修饰参数组(可以缺省)。当x,Y都是顶点坐标时,GraphF(X,Y,S)画出以x,Y为端点,s为参数的线;当x是一组顶点坐标,而Y对应于X的函数值时,GraphF(X,Y,S)画出函数Y的二维图形。 2.GraphF(X,Y,Z,S) 这是三维函数的作图格式。z是x和Y的函数。x,Y以二维坐标形式表示函数值z的作图区域D,s表示图形修饰参数组(可以缺省)。GraphF(x,Y,Z,S)画出定义域为D的函数z的三维图形。 值得注意的是,Matlab的作图函数总是描绘数据点(X,Y)(在平面上)或(x,Y,z)(在空间中)的图形。前者视为Y的函数,而后者视为z的函数。函数GraphF在作图前数据点必须事先给定,在作图时函数GraphF将各数据点用光滑的曲线连接成图形。另外,X,Y,Z还 ÷收稿日期2004—02—19 资助项目新疆大学校基金“应用软件程序设计”重点课程建设项目资助 作者简介黄琼湘(1958)男,湖南衡阳人,教授,主要从事组合数学与图论、计算机算法研究

matlab函数名称总结

一、常用对象操作:除了一般windows窗口的常用功能键外。 1、!dir 可以查看当前工作目录的文件。!dir& 可以在dos状态下查看。 2、who 可以查看当前工作空间变量名, whos 可以查看变量名细节。 3、功能键: 功能键快捷键说明 方向上键Ctrl+P 返回前一行输入 方向下键Ctrl+N 返回下一行输入 方向左键Ctrl+B 光标向后移一个字符 方向右键Ctrl+F 光标向前移一个字符 Ctrl+方向右键 Ctrl+R 光标向右移一个字符 Ctrl+方向左键 Ctrl+L 光标向左移一个字符 home Ctrl+A 光标移到行首 End Ctrl+E 光标移到行尾 Esc Ctrl+U 清除一行 Del Ctrl+D 清除光标所在的字符 Backspace Ctrl+H 删除光标前一个字符 Ctrl+K 删除到行尾 Ctrl+C 中断正在执行的命令 4、clc可以命令窗口显示的内容,但并不清除工作空间。 二、函数及运算 1、运算符: +:加,-:减, *:乘, /:除,\:左除 ^:幂,':复数的共轭转置,():制定运算顺序。 2、常用函数表: sin( ) 正弦(变量为弧度) Cot( ) 余切(变量为弧度) sind( ) 正弦(变量为度数) Cotd( ) 余切(变量为度数) asin( ) 反正弦(返回弧度) acot( ) 反余切(返回弧度) Asind( ) 反正弦(返回度数) acotd( ) 反余切(返回度数) cos( ) 余弦(变量为弧度) exp( ) 指数 cosd( ) 余弦(变量为度数) log( ) 对数 acos( ) 余正弦(返回弧度) log10( ) 以10为底对数 acosd( ) 余正弦(返回度数) sqrt( ) 开方 tan( ) 正切(变量为弧度) realsqrt( ) 返回非负根 tand( ) 正切(变量为度数) abs( ) 取绝对值 atan( ) 反正切(返回弧度) angle( ) 返回复数的相位角

MATLAB常用函数

数字信号处理与MATLAB 实现 1. n1=[ns:nf]; x1=[zeros(1,n0-ns),1,zeros (1,nf-n0)]; %单位抽样序列的产生 2. subplot(2,2,4) 画2行2列的第4个图 3. stem(n,x) %输出离散序列,(plot 连续) 4. 编写子程序可调用 4.1 单位抽样序列)(0n n -δ生成函数impseq.m [x,m]=impseq(n0,ns,nf); %序列的起点为ns ,终点为nf ,在n=n0点处生成一个单位脉冲 n=[-5:5];x1=3*impseq(2,-5,5)-impseq(-4,-5,5) x1 = 0 -1 0 0 0 0 0 3 0 0 0 n=[-5:5];x1=3*impseq(2,-4,5)-impseq(-4,-5,4) %起点到终点长度要一致 x1 = 0 -1 0 0 0 0 3 0 0 0 4.2 单位阶跃序列)(0n n u -生成函数stepseq.m [x,n]=stepseq(no,ns,nf) %序列的起点为ns ,终点为nf ,在n=n0点处生成一个单位阶跃 4.3 两个信号相加的生成函数sigadd.m [y,n]=sigadd(x1,n1,x2,n2) 4.4 两个信号相乘的生成函数sigmult.m [y,n]=sigmult(x1,n1,x2,n2) 4.5 序列移位y(n)=x(n-n0)的生成函数sigshift.m [y,n]=sigshift(x,m,n0) 4.6 序列翻褶y(n)=x(-n)的生成函数sigfold.m [y,n]=sigfold(x,n) 4.7 evenodd.m 函数可以将任一给定的序列x(n)分解为xe(n)和xo(n)两部分 [xe,xo,m]=evenodd(x,n) 4.8 序列从负值开始的卷积conv_m, conv 默认从0开始 function [y,ny]=conv_m(x,nx,h,nh) 有{x(n):nx1≤n ≤nx2},{h(n):nh1≤n ≤nh2}, 卷积结果序列为 {y(n):nx1+nh1≤n ≤nx2+nh2} 例. 设1132)(-++=z z z X ,1225342)(-+++=z z z z X ,求)()()(21z X z X z Y += 程序: x1=[1,2,3];n1=-1:1; x2=[2,4,3,5];n2=-2:1; [y,n]=conv_m(x1,n1,x2,n2)

MATLAB常用命令检索大全

MATLAB命令 MATLAB COMMANDS AND FUNCTIONS LIST A A ABS 绝对值、模、字符的ASCII码值 ACOS 反余弦 ACOSH 反双曲余弦 ACOT 反余切 ACOTH 反双曲余切 ACSC 反余割 ACSCH 反双曲余割 ALIGN 启动图形对象几何位置排列工具 ALL 所有元素非零为真 ANGLE 相角 ANS 表达式计算结果的缺省变量名 ANY 所有元素非全零为真 AREA 面域图 ARGNAMES 函数M文件宗量名 ASEC 反正割 ASECH 反双曲正割 ASIN 反正弦 ASINH 反双曲正弦 ASSIGNIN 向变量赋值 ATAN 反正切 ATAN2 四象限反正切 ATANH 反双曲正切 AUTUMN 红黄调秋色图阵 AXES 创建轴对象的低层指令 AXIS 控制轴刻度和风格的高层指令 B B BAR 二维直方图 BAR3 三维直方图 BAR3H 三维水平直方图 BARH 二维水平直方图 BASE2DEC X进制转换为十进制 BIN2DEC 二进制转换为十进制 BLANKS 创建空格串 BONE 蓝色调黑白色图阵 BOX 框状坐标轴 BREAK WHILE 或FOR 环中断指令

BRIGHTEN 亮度控制 C C CAPTURE (3版以前)捕获当前图形 CART2POL 直角坐标变为极或柱坐标 CART2SPH 直角坐标变为球坐标 CAT 串接成高维数组 CAXIS 色标尺刻度 CD 指定当前目录 CDEDIT 启动用户菜单、控件回调函数设计工具CDF2RDF 复数特征值对角阵转为实数块对角阵CEIL 向正无穷取整 CELL 创建元胞数组 CELL2STRUCT 元胞数组转换为构架数组CELLDISP 显示元胞数组内容 CELLPLOT 元胞数组内部结构图示 CHAR 把数值、符号、内联类转换为字符对象CHI2CDF 分布累计概率函数 CHI2INV 分布逆累计概率函数 CHI2PDF 分布概率密度函数 CHI2RND 分布随机数发生器 CHOL CHOLESKY分解 CLABEL 等位线标识 CLA 清除当前轴 CLASS 获知对象类别或创建对象 CLC 清除指令窗 CLEAR 清除内存变量和函数 CLF 清除图对象 CLOCK 时钟 COLORCUBE 三浓淡多彩交叉色图矩阵COLORDEF 设置色彩缺省值 COLORMAP 色图 COLSPACE 列空间的基 CLOSE 关闭指定窗口 COLPERM 列排序置换向量 COMET 彗星状轨迹图 COMET3 三维彗星轨迹图 COMPASS 射线图 COMPOSE 求复合函数 COND (逆)条件数 CONDEIG 计算特征值、特征向量同时给出条件数CONDEST 范-1条件数估计

Matlab中常见数学函数的使用

给自己看的----Matlab的内部常数(转) 2008/06/19 14:01[Ctrl C/V--学校 ] MATLAB基本知识 Matlab的内部常数 pi 圆周率 exp(1) 自然对数的底数e i 或j 虚数单位 Inf或inf 无穷大 Matlab的常用内部数学函数

我们也可在matlab中调用maple的命令进行多项式的运算,调用格式如下: maple(’maple中多项式的运算命令’) 如何用matlab进行分式运算 发现matlab只有一条处理分式问题的命令,其使用格式如下: [n,d]=numden(f)把符号表达式f化简为有理形式,其中分子和分母的系数为整数且分子分母不含公约项,返回结果n为分子,d为分母。注意:f必须为符号表达式 不过我们可以调用maple的命令,调用方法如下: maple(’denom(f)’)提取分式f的分母 maple(’numer(f)’)提取分式f的分子 maple(’normal(f)’ ) 把分式f的分子与分母约分成最简形式 maple(’expand(f)’) 把分式f的分子展开,分母不变且被看成单项。 maple(’factor(f)’) 把分式f的分母和分子因式分解,并进行约分。 如何用Matlab进行因式分解 syms 表达式中包含的变量factor(表达式) 如何用Matlab展开 syms 表达式中包含的变量expand(表达式) 如何用Matlab进行化简 syms 表达式中包含的变量simplify(表达式) 如何用Matlab合并同类项 syms 表达式中包含的变量collect(表达式,指定的变量) 如何用Matlab进行数学式的转换 调用Maple中数学式的转换命令,调用格式如下: maple(‘Maple的数学式转换命令’) 即:maple(‘convert(表达式,form)’)将表达式转换成form的表示方式 maple(‘convert(表达式,form, x)’)指定变量为x,将依赖于变量x的函数转换成form的表示方式(此指令仅对form为exp与sincos的转换式有用) 如何用Matlab进行变量替换 syms 表达式和代换式中包含的所有变量subs(表达式,要替换的变量或式子,代换式) 如何用matlab进行复数运算 a+b*i 或 a +b*j表示复数a+bi 或a+bj real(z)求复数z的实部 imag(z)求复数z的虚部 abs(z)求复数z的模 angle(z)求复数z的辐角, conj(z)求复数z的共轭复数 exp(z)复数的指数函数,表示e^z 如何在matlab中表示集合 [a, b, c,…] 表示由a, b, c,…组成的集合(注意:元素之间也可用空格隔开) unique(A) 表示集合A的最小等效集合(每个元素只出现一次) 也可调用maple的命令,格式如下: maple('{a, b, c,…}')表示由a, b, c,…组成的集合 下列命令可以生成特殊的集合: maple(‘{seq(f(i),i=n..m)}’)生成集合{f(n), f(n+1), f(n+2), … , f(m)} 如何用Matlab求集合的交集、并集、差集和补集

MATLAB函数大全(MATLAB函数总集,史上最全)

MATLAB函数大全 代充全国移动、联通、电信话费、腾讯QQ业务、网游点卡 淘宝店址:https://www.doczj.com/doc/c715964406.html,/ 信誉至上,服务第一 A a abs 绝对值、模、字符的ASCII码值 acos 反余弦 acosh 反双曲余弦 acot 反余切 acoth 反双曲余切 acsc 反余割 acsch 反双曲余割 align 启动图形对象几何位置排列工具 all 所有元素非零为真 angle 相角 ans 表达式计算结果的缺省变量名 any 所有元素非全零为真 area 面域图 argnames 函数M文件宗量名 asec 反正割 asech 反双曲正割 asin 反正弦 asinh 反双曲正弦 assignin 向变量赋值 atan 反正切 atan2 四象限反正切 atanh 反双曲正切 autumn 红黄调秋色图阵 axes 创建轴对象的低层指令 axis 控制轴刻度和风格的高层指令 B b bar 二维直方图 bar3 三维直方图 bar3h 三维水平直方图 barh 二维水平直方图 base2dec X进制转换为十进制

bin2dec 二进制转换为十进制 blanks 创建空格串 代充全国移动、联通、电信话费、腾讯QQ业务、网游点卡 淘宝店址:https://www.doczj.com/doc/c715964406.html,/ 信誉至上,服务第一 bone 蓝色调黑白色图阵 box 框状坐标轴 break while 或for 环中断指令 brighten 亮度控制 C c capture (3版以前)捕获当前图形 cart2pol 直角坐标变为极或柱坐标 cart2sph 直角坐标变为球坐标 cat 串接成高维数组 caxis 色标尺刻度 cd 指定当前目录 cdedit 启动用户菜单、控件回调函数设计工具 cdf2rdf 复数特征值对角阵转为实数块对角阵 ceil 向正无穷取整 cell 创建元胞数组 cell2struct 元胞数组转换为构架数组 celldisp 显示元胞数组内容 cellplot 元胞数组内部结构图示 char 把数值、符号、内联类转换为字符对象 chi2cdf 分布累计概率函数 chi2inv 分布逆累计概率函数 chi2pdf 分布概率密度函数 chi2rnd 分布随机数发生器 chol Cholesky分解 clabel 等位线标识 cla 清除当前轴 class 获知对象类别或创建对象 clc 清除指令窗 clear 清除内存变量和函数 clf 清除图对象 clock 时钟 colorcube 三浓淡多彩交叉色图矩阵

MatLab常见函数和运算符号解读

MatLab常见函数和运算符号 基本运算 convhull :凸壳函数 cumprod :累计积 cumsum :累计和 cumtrapz :累计梯形数值积分 delaunay :Delaunay三角化 dsearch :求最近点(这是两个有趣的函数 factor :质数分解inpolygon :搜索多边形内的点 max :最大元素 mean :平均值 median :数组的中间值 min :最小值 perms :向量所有排列组成矩阵 polyarea :多边形的面积 primes :生成质数列表 prod :数组元素积 sort :元素按升序排列 sortrows :将行按升序排列

std :标准差 sum :元素和 trapz :梯形数值积分 tsearch :搜索Delaunay三角形var :方差 voronoi :Voronoi图 del2 :Laplacian离散 diff :差分和近似微分gradient:数值梯度 corrcoef :相关系数 cov :协方差矩阵 xcorr :互相关系数 xcov :互协方差矩阵 xcorr2 :二维互相关 conv :卷积和多项式相乘conv2 :二维卷积 deconv :反卷积 filter :滤波 filter2 :二维数字滤波

傅立叶变换 abs :绝对值和模 angle :相角 cplxpair :按复共扼把复数分类 fft :一维快速傅立叶变换 fft2 :二维快速傅立叶变换 fftshit :将快速傅立叶变换的DC分量移到谱中央ifft :以为逆快速傅立叶变换 ifft2 :二维逆快速傅立叶变换 ifftn :多维逆快速傅立叶变换 ifftshift :逆fft平移 nextpow2 :最相邻的2的幂 unwrap :修正相角 cross :向量叉积 intersect:集合交集 ismember :是否集合中元素 setdiff :集合差集 setxor :集合异或(不在交集中的元素 union :两个集合的并

Matlab中常用的函数集

sort (排序) xlsread ( exl文件导入) load (txt 文件,mat文件等导入) 附录Ⅰ工具箱函数汇总 Ⅰ.1 统计工具箱函数 表Ⅰ-1 概率密度函数 函数名对应分布的概率密度函数 betapdf 贝塔分布的概率密度函数 binopdf 二项分布的概率密度函数 chi2pdf 卡方分布的概率密度函数 exppdf 指数分布的概率密度函数 fpdf f分布的概率密度函数 gampdf 伽玛分布的概率密度函数 geopdf 几何分布的概率密度函数 hygepdf 超几何分布的概率密度函数normpdf 正态(高斯)分布的概率密度函数lognpdf 对数正态分布的概率密度函数nbinpdf 负二项分布的概率密度函数 ncfpdf 非中心f分布的概率密度函数nctpdf 非中心t分布的概率密度函数 ncx2pdf 非中心卡方分布的概率密度函数poisspdf 泊松分布的概率密度函数 raylpdf 雷利分布的概率密度函数 tpdf 学生氏t分布的概率密度函数unidpdf 离散均匀分布的概率密度函数unifpdf 连续均匀分布的概率密度函数weibpdf 威布尔分布的概率密度函数 表Ⅰ-2 累加分布函数 函数名对应分布的累加函数 betacdf 贝塔分布的累加函数 binocdf 二项分布的累加函数 chi2cdf 卡方分布的累加函数 expcdf 指数分布的累加函数 fcdf f分布的累加函数 gamcdf 伽玛分布的累加函数 geocdf 几何分布的累加函数 hygecdf 超几何分布的累加函数

logncdf 对数正态分布的累加函数 nbincdf 负二项分布的累加函数 ncfcdf 非中心f分布的累加函数 nctcdf 非中心t分布的累加函数 ncx2cdf 非中心卡方分布的累加函数 normcdf 正态(高斯)分布的累加函数 poisscdf 泊松分布的累加函数 raylcdf 雷利分布的累加函数 tcdf 学生氏t分布的累加函数 unidcdf 离散均匀分布的累加函数 unifcdf 连续均匀分布的累加函数 weibcdf 威布尔分布的累加函数 表Ⅰ-3 累加分布函数的逆函数 函数名对应分布的累加分布函数逆函数 betainv 贝塔分布的累加分布函数逆函数 binoinv 二项分布的累加分布函数逆函数 chi2inv 卡方分布的累加分布函数逆函数 expinv 指数分布的累加分布函数逆函数 finv f分布的累加分布函数逆函数 gaminv 伽玛分布的累加分布函数逆函数 geoinv 几何分布的累加分布函数逆函数hygeinv 超几何分布的累加分布函数逆函数logninv 对数正态分布的累加分布函数逆函数nbininv 负二项分布的累加分布函数逆函数ncfinv 非中心f分布的累加分布函数逆函数nctinv 非中心t分布的累加分布函数逆函数 ncx2inv 非中心卡方分布的累加分布函数逆函数icdf norminv 正态(高斯)分布的累加分布函数逆函数poissinv 泊松分布的累加分布函数逆函数 raylinv 雷利分布的累加分布函数逆函数 tinv 学生氏t分布的累加分布函数逆函数unidinv 离散均匀分布的累加分布函数逆函数unifinv 连续均匀分布的累加分布函数逆函数weibinv 威布尔分布的累加分布函数逆函数 表Ⅰ-4 随机数生成器函数

(完整版)matlab函数大全最完整版

MATLAB函数大全 Matlab有没有求矩阵行数/列数/维数的函数? ndims(A)返回A的维数 size(A)返回A各个维的最大元素个数 length(A)返回max(size(A)) [m,n]=size(A)如果A是二维数组,返回行数和列数nnz(A)返回A中非0元素的个数 MATLAB的取整函数:fix(x), floor(x) :,ceil(x) , round(x) (1)fix(x) : 截尾取整. >> fix( [3.12 -3.12]) ans = 3 -3 (2)floor(x):不超过x 的最大整数.(高斯取整) >> floor( [3.12 -3.12]) ans =

3 -4 (3)ceil(x) : 大于x 的最小整数>> ceil( [3.12 -3.12]) ans = 4 -3 (4)四舍五入取整 >> round(3.12 -3.12) ans = >> round([3.12 -3.12]) ans =

3 -3 >> 如何用matlab生成随机数函数 rand(1) rand(n):生成0到1之间的n阶随机数方阵rand(m,n):生成0到1之间的m×n的随机数矩阵(现成的函数) 另外: Matlab随机数生成函数 betarnd 贝塔分布的随机数生成器 binornd 二项分布的随机数生成器 chi2rnd 卡方分布的随机数生成器 exprnd 指数分布的随机数生成器 frnd f分布的随机数生成器 gamrnd 伽玛分布的随机数生成器 geornd 几何分布的随机数生成器 hygernd 超几何分布的随机数生成器

matlab命令大全

matlab命令 一、常用对象操作:除了一般windows窗口的常用功能键外。 1、!dir 可以查看当前工作目录的文件。 !dir& 可以在dos状态下查看。 2、who 可以查看当前工作空间变量名,whos 可以查看变量名细节。 3、功能键: 功能键快捷键说明 方向上键 Ctrl+P 返回前一行输入 方向下键 Ctrl+N 返回下一行输入 方向左键 Ctrl+B 光标向后移一个字符 方向右键 Ctrl+F 光标向前移一个字符 Ctrl+方向右键 Ctrl+R 光标向右移一个字符 Ctrl+方向左键 Ctrl+L 光标向左移一个字符 home Ctrl+A 光标移到行首 End Ctrl+E 光标移到行尾 Esc Ctrl+U 清除一行 Del Ctrl+D 清除光标所在的字符 Backspace Ctrl+H 删除光标前一个字符 Ctrl+K 删除到行尾 Ctrl+C 中断正在执行的命令 4、clc可以命令窗口显示的内容,但并不清除工作空间。 二、函数及运算 1、运算符: +:加,-:减, *:乘, /:除,\:左除 ^:幂,‘:复数的共轭转置,():制定运算顺序。 2、常用函数表: sin( ) 正弦(变量为弧度) Cot( ) 余切(变量为弧度) sind( ) 正弦(变量为度数) Cotd( ) 余切(变量为度数) asin( ) 反正弦(返回弧度) acot( ) 反余切(返回弧度) Asind( ) 反正弦(返回度数) acotd( ) 反余切(返回度数) cos( ) 余弦(变量为弧度) exp( ) 指数 cosd( ) 余弦(变量为度数) log( ) 对数 acos( ) 余正弦(返回弧度) log10( ) 以10为底对数 acosd( ) 余正弦(返回度数) sqrt( ) 开方

matlab常用函数表

若要查看最新内容,请点击此处访问英文页面。MATLAB 函数 按字母顺序排列的列表按类别语言基础知识 输入命令 ans最近计算的答案 clc清除命令行窗口 diary将命令行窗口文本保存到文件中 format设置命令行窗口输出显示格式 home发送光标复位 iskeyword确定输入是否为 MATLAB 关键字 more控制命令行窗口分页输出 矩阵和数组 数组的创建和串联 accumarray使用累加构造数组 blkdiag根据输入参数构造分块对角矩阵 diag创建对角矩阵或获取矩阵的对角元素 eye单位矩阵 false逻辑 0(假) freqspace频率响应的频率间距 linspace生成线性间距矢量 logspace生成对数间距矢量 meshgrid二维和三维空间中的矩形网格 ndgrid N 维空间中的矩形网格 ones创建全部为 1 的数组 rand均匀分布的随机数 true逻辑值 1(真) zeros创建全零数组 cat沿指定维度串联数组 horzcat水平串联数组 vertcat垂直串联数组 索引 colon创建矢量、数组下标和 for 循环迭代

end终止代码块或指示最大数组索引ind2sub线性索引的下标 sub2ind将下标转换为线性索引 数组维度 length最大数组维度的长度ndims数组维度数目 numel数组元素的数目 size数组维度 height表行数 width表的变量数 iscolumn确定输入是否为列矢量isempty确定数组是否为空ismatrix确定输入是否为矩阵 isrow确定输入是否为行矢量isscalar确定输入是否为标量isvector确定输入是否为矢量 数组排序和调整 blkdiag根据输入参数构造分块对角矩阵circshift循环偏移数组ctranspose复共轭转置 diag创建对角矩阵或获取矩阵的对角元素flip翻转元素顺序 fliplr将数组从左向右翻转 flipud将数组从上向下翻转ipermute N 维数组的逆置换维度permute重新排列 N 维数组的维度repelem重复数组元素副本repmat重复数组副本 reshape重新排列数组 rot90将数组旋转 90 度shiftdim移动维度 issorted确定集元素是否处于排序顺序sort对数组元素排序sortrows对数组行排序squeeze删除单一维度transpose转置矢量或矩阵vectorize矢量化表达式

MatLab常用函数大全

1、求组合数 C,则输入: 求k n nchoosek(n,k) 例:nchoosek(4,2) = 6. 2、求阶乘 求n!.则输入: Factorial(n). 例:factorial(5) = 120. 3、求全排列 perms(x). 例:求x = [1,2,3]; Perms(x),输出结果为: ans = 3 2 1 3 1 2 2 3 1 2 1 3 1 2 3 1 3 2 4、求指数 求a^b:Power(a,b) ; 例:求2^3 ; Ans = pow(2,3) ; 5、求行列式 求矩阵A的行列式:det(A); 例:A=[1 2;3 4] ; 则det(A) = -2 ; 6、求矩阵的转置 求矩阵A的转置矩阵:A’ 转置符号为单引号. 7、求向量的指数 求向量p=[1 2 3 4]'的三次方:p.^3 例: p=[1 2 3 4]' A=[p,p.^2,p.^3,p.^4] 结果为:

注意:在p 与符号”^”之间的”.”不可少. 8、求自然对数 求ln(x):Log(x) 例:log(2) = 0.6931 9、求矩阵的逆矩阵 求矩阵A 的逆矩阵:inv(A) 例:a= [1 2;3 4]; 则 10、多项式的乘法运算 函数conv(p1,p2)用于求多项式p1和p2的乘积。这里,p1、p2是两个多项式系数向量。 例2-2 求多项式43810x x +-和223x x -+的乘积。 命令如下: p1=[1,8,0,0,-10]; p2=[2,-1,3]; c=conv(p1,p2) 11、多项式除法 函数[q ,r]=deconv(p1,p2)用于多项式p1和p2作除法运算,其中q 返回多项式p1除以p2的商式,r 返回p1除以p2的余式。这里,q 和r 仍是多项式系数向量。 例2-3 求多项式43810x x +-除以多项式223x x -+的结果。 命令如下: p1=[1,8,0,0,-10]; p2=[2,-1,3]; [q,r]=deconv(p1,p2) 12、求一个向量的最大值 求一个向量x 的最大值的函数有两种调用格式,分别是:

相关主题
文本预览
相关文档 最新文档