How to create a custom function?
显示 更早的评论
If you are given an equation and told to write a function that would solve the equation when a number is input.
ex.
y=(2/x)*t
x ranges from 0-30
and the input is a value for t.
The main problem is that when i try to use "function" MATLAB says that "function definitions are not permitted in this context"
采纳的回答
更多回答(1 个)
per isakson
2014-3-1
0 个投票
- See: Function Basics and
- give it an honest try
- if you run into problems then return here with specific questions
2 个评论
Nicole Isbell
2014-3-1
per isakson
2014-3-1
A function shall be defined (/typed) in a text file. The word function on the first line (may optionally be preceded by comments) and the word end (optionally) on the last line. See Create Functions in Files
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!