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개)

Walter Roberson
Walter Roberson 2013년 11월 12일

0 개 추천

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