MATLAB 内联函数 与匿名函数的基本用法(笔记)
2017-05-15 15:13
381 查看
inline 函数
官方文档inline Construct inline object.
inline will be removed in a future release. Use anonymous functions instead. inline(EXPR) constructs an inline function object from the MATLAB expression contained in the string EXPR. The input arguments are automatically determined by searching EXPR for variable names (see SYMVAR). If no variable exists, 'x' is used. inline(EXPR, ARG1, ARG2, ...) constructs an inline function whose input arguments are specified by the strings ARG1, ARG2, ... Multicharacter symbol names may be used. inline(EXPR, N), where N is a scalar, constructs an inline function whose input arguments are 'x', 'P1', 'P2', ..., 'PN'. Examples: g = inline('t^2') g = inline('sin(2*pi*f + theta)') g = inline('sin(2*pi*f + theta)', 'f', 'theta') g = inline('x^P1', 1)
% 使用inline 创建初等函数的程序很简洁
%要计算多个点的函数值是,注意四种数组运算的使用
% 用法:
%1据expr建立内联函数,函数自变量符号根据表达式自动确定;
%2: 定义是指定自变量符号
%3:自变量符号为x,p1
%定义匿名函数
% 定义方法; @(参数列表)(函数列表)
% 例 f=@(x,y)(x.^2+y.^2)
%val=f(1:5,11:15)
返回:
% val =
122 148 178 212 250
相关文章推荐
- Puppet笔记:介绍及基本用法
- matlab plot函数说明和legend函数的基本用法(转)
- Matlab中plot基本用法
- C语言学习笔记(三) 输入输出函数的基本用法以及运算符
- matlab学习笔记 image,imagesc,imshow的用法
- List Control & Tree Control & CImageCtrl 基本常规用法学习笔记
- matlab图片,矩阵,函数的基本用法
- 有关线性代数的Matlab代码笔记(5)——四个基本子空间
- Python学习笔记:05 数组的基本用法(Tuple和List)
- Dynamic CRM 2013学习笔记(二)插件基本用法及调试
- 【VC++ 中使用ADO操作数据库学习笔记】_ConnectionPtr指针的基本用法
- memcache基本用法 笔记
- 【转载】Matlab基本用法小结
- matlab中cell的用法笔记
- matlab的基本用法
- Puppet笔记:介绍及基本用法
- 浅析MATLAB中的内联函数、匿名函数和函数函数
- matlab的基本用法
- matlab中的函数用法笔记
- C语言学习笔记(1)--基本概念和函数用法