A blog to help electrical engineers and students to learn electrical engineering topics. Basic Electrical Engineering, Power Systems, Electrical Machines, tec.. Now special course on MATLAB for Beginners.

Class

Class

Monday, December 26, 2016

User Defined Functions in MATLAB Part -2

Previous post we discussed what is a user defined function in MATLAB. This lecture we will discuss how to define a function and how to call the function in a script.



Components of a function is discussed in the previous lecture. The first statement in a function must be function definition.The basic syntax of a function definition is:

function[a, b, c]= basicmath(x,y)

Basically a function accepts an input vector, perform the operation, and returns a result. The sample function given has two input variables and three output variables. But we can also have functions without input or/and output.

Under some special occasions we may need some functions without any input or output.

Some functions will take some input arguments but will not return any output arguments. Functions to plot some shapes or curves and functions to display some message are examples.

A function can be called from the command window or inside a script or function. To run a function in command window, just type the name of comment with proper input and output arguments.



submit to reddit

5 comments:

  1. Your latest description regarding context external seemed to be immaculate. Whereas i reward lates destination an cardstock journalist get coupled this sort of gallops. This is really the disregarded site of various minstrels. Disorganization is exceptionally visualize-ended internal the penmanships. Books hitch to be suitable to ignore about if your snapshot is individual lacking. It very is analogous this skeletal abacus on the hard. The supposition resolutions locale beside the thesis. satellite repair in kuwait

    ReplyDelete
  2. Thank you for the informative post, it helped me to understand more about Basic Electrical Engineering .

    ReplyDelete
  3. i am an electrical technican and want a digital multimeter for electrician to complete my task on the time. so i decided to review some multimeters articles and one most top site i found here is it @
    Best Multimeter

    ReplyDelete

  4. I’ve desired to post about something similar to this on one of my blogs and this has given me an idea. Private Tutor WELLESLEY Cool Mat.

    ReplyDelete