编辑: 苹果的酸 | 2019-07-11 |
s = sin(x_rad);
c = cos(x_rad);
t = tan(x_rad);
Keyword: function Function Name (same as file name .m) Output Argument(s) Input Argument(s) Online Help MATLAB Code Copyright ? 2013-2014 RM, All Rights Reserved. 函数编写 3-49 Copyright ? 2013-2014 RM, All Rights Reserved. 函数编写 3-50 Copyright ? 2013-2014 RM, All Rights Reserved. 注意事项 ? 函数的命名规则与变量相同(必须以字母开头) ? 函数文件名必须与函数名一致,并且是独立的m 文件 ? 永久变量 nargin 和nargout ? 矢量化函数 3-51 函数中的变量 Copyright ? 2013-2014 RM, All Rights Reserved. 内存空间 ? base workspace C whos C a script executed in the base workspace has access to that variable ? function workspace C each function has its own workspace where it stores its variables. This workspace is kept separate from the base workspace and all other workspaces to protect the integrity of the data used by the function 3-53 Copyright ? 2013-2014 RM, All Rights Reserved. function workspace 3-54 Copyright ? 2013-2014 RM, All Rights Reserved. 数值传递 3-55 Copyright ? 2013-2014 RM, All Rights Reserved. 位置传递 3-56 Copyright ? 2013-2014 RM, All Rights Reserved. 全局变量 3-57 Copyright ? 2013-2014 RM, All Rights Reserved. persistent变量 3-58 Copyright ? 2013-2014 RM, All Rights Reserved. persistent变量 3-59 主讲人:毛睿 北京师范大学 地表过程与资源生态国家重点实验室 Email: [email protected] 3/19/2015 Copyright ? 2014-2015 RM, All Rights Reserved.