How to create a custom function?
Mostrar comentarios más antiguos
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"
Respuesta aceptada
Más respuestas (1)
per isakson
el 1 de Mzo. de 2014
0 votos
- See: Function Basics and
- give it an honest try
- if you run into problems then return here with specific questions
2 comentarios
Nicole Isbell
el 1 de Mzo. de 2014
per isakson
el 1 de Mzo. de 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
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!