Need help creating a function with multiple inputs.

Here is my function.
function N = line(A_0,a,t)
N = exp.^(A_0./a).*(1-exp.^(-a.*t));
end
It's giving me an error saying that function name 'line' is known to Matlab by its file name 'N'. How can I fix this?

回答(1 个)

You need to save it to the file line.m instead of saving it to N.m
Caution: line() is the MATLAB function used to draw lines. It is not recommended that you use it for your own function name!

1 个评论

I changed it to this:
function N = lin(A_0,a,t) N = exp.^(A_0./a).*(1-exp.^(-a.*t)); end
but when I try to put in values for lin(A_0,a,t) it says "Error in lin (line 2) N = exp.^(A_0./a).*(1-exp.^(-a.*t));"
How do I fix this?

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Entering Commands 的更多信息

提问:

2013-11-12

评论:

2013-11-12

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by