- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
实验六 Malab 函数进阶
实验六 Matlab 函数进阶、实验目的
匿名函数嵌套函数子函数私有函数、实验内容与要求
匿名函数嵌套函数子函数私有函数Help菜单查: Anonymous Functions, Primary Functions, Nested Functions, Subfunctions, Private Functions, function handle
3.完成实验习题
4.将完成每题所用的命令写入一个文本文件,取名为: 学号最后两位_机号_姓名.txt, 下课前通过管理系统提交作业
三、实验习题匿名函数
首先用嵌套函数定义
取不同的值时返回不同的函数
然后求用fzero求时方程的根.
实验提示:
matlab帮助中搜索Types of Functions,可以看到matlab常用的函数种类:
Anonymous Functions -- 匿名函数
Primary Functions -- 主函数
Nested Functions -- 嵌套函数
Subfunctions -- 子函数
Private Functions -- 私有函数 Private functions are functions that reside in subdirectories with the special name private. These functions are called private because they are visible only to M-file functions and M-file scripts that meet these conditions: A function that calls a private function must be defined in an M-file that resides in the directory immediately above that private subdirectory. A script that calls a private function must itself be called from an M-file function that has access to the private function according to the above rule.
1.函数句柄
function_handle @
Syntax
handle @functionname
handle @ arglist anonymous_function
fhandle @ arglist expr
如
sqr @ x x.^2;Handle used in calling functions indirectly
A function handle is a MATLAB value that provides a means of calling a function indirectly. You can pass function handles in calls to other functions often called function functions . You can also store function handles in data structures for later use for example, as Handle Graphics callbacks . A function handle is one of the standard MATLAB data types.
handle @ arglist anonymous_function constructs an anonymous function and returns a handle to that function. The body of the function, to the right of the parentheses, is a single MATLAB statement or command. arglist is a comma-separated list of input arguments. Execute the function by calling it by means of the function handle, handle.
Examples
Example 1 — Constructing a Handle to a Named Function
The following example creates a function handle for t
原创力文档


文档评论(0)