How to create a custom function?
Ältere Kommentare anzeigen
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"
Akzeptierte Antwort
Weitere Antworten (1)
per isakson
am 1 Mär. 2014
0 Stimmen
- See: Function Basics and
- give it an honest try
- if you run into problems then return here with specific questions
2 Kommentare
Nicole Isbell
am 1 Mär. 2014
per isakson
am 1 Mär. 2014
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
Kategorien
Mehr zu Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!