How to create a custom function?
Afficher commentaires plus anciens
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"
Réponse acceptée
Plus de réponses (1)
per isakson
le 1 Mar 2014
0 votes
- See: Function Basics and
- give it an honest try
- if you run into problems then return here with specific questions
2 commentaires
Nicole Isbell
le 1 Mar 2014
per isakson
le 1 Mar 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
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!