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,...

Thursday, December 1, 2016

User Defined Functions in MATLAB - Part 1



User-defined functions are similar to the MATLAB predefined functions. A function is a MATLAB program that can accept inputs and produce outputs. A function can be called or executed by another program or function. Code for a function is done in an Editor window or any text editor same way as script and saved as m-file. The m-file must have the same name as the function. It is important that you give meaningful variable names to variables inside...