Function definitions, MATLAB Programming

Function definitions:

There are various ways to organize the scripts and functions, but for now every function which we write will be stored in a separate M-file, that is why they are commonly known as M-file functions.

The function in the MATLAB which returns a single result consists of

(A)The function header (i.e., the first line); this has

-  the reserved word function

-  as the function returns an answer, the name of the output argument

followed by the assignment operator =

- the name of the function (Important: This must be similar as the name of the M-file in which this function is stored in order to avoid the confusion)

- input arguments in the parentheses; these correspond to the arguments which are passed to the function in the function call

(B)A comment which explains what the function does (this is printed if help is used)

(C)The body of the function that involves all the statements and eventually should assign a value to the output argument

Posted Date: 10/18/2012 7:14:31 AM | Location : United States







Related Discussions:- Function definitions, Assignment Help, Ask Question on Function definitions, Get Answer, Expert's Help, Function definitions Discussions

Write discussion on Function definitions
Your posts are moderated
Related Questions

256789;267825;625892;982895;598289

Random numbers: Whenever a program is being written to work with a data, and the data is not yet available, it is frequently useful to test the program first by initializing t

can we use regression in bioinformatics toolbox?

how to wriet program for batch reactor


It is desired to determine the DFT of the analogue signal x (t) = 25 cos(10 Πt)cos(400Πt). (a) Find the Nyquist rate of the signal.   (b) What is the record (signal) length i

You are a quant analyst reporting directly to a portfolio manager. Your manager requires you to generate a simple code to compute several statistics for the following potential por

please tell me the procedure of Anova two Way analysis in matlab?