MATLAB中函数function是怎么用的

如题所述

1.新建一个m文件,把function函数复制进去;然后保存(名称应该是自动生成的,即为sinh.m,不过最好不要用和系统中的文件一样的名称,可以先help查看一下matlab是否有和sinh重复的名称,若有的话,得把function函数改个名称),保存的地址为当前工作目录。
2.在命令窗口调用function函数:
sinh(5)即可
温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-05-10
function
Declare function name, inputs, and outputs
collapse all in page
Syntax
function [y1,...,yN] = myfun(x1,...,xM)
example
Description
example
function [y1,...,yN] = myfun(x1,...,xM) declares a function named myfun that accepts inputs x1,...,xM and returns outputsy1,...,yN. This declaration statement must be the first executable line of the function. Valid function names begin with an alphabetic character, and can contain letters, numbers, or underscores.

相似回答