Function cirarea - anonymous functions, MATLAB in Engineering

Function cirarea - Anonymous functions:

The function handle name is cirarea. The one argument is passed to the input argument radius. The body of the function is an expression pi * radius .^2. The .^ operator is used so that the vector of radii can be passed to the function.

The function is then called by using the handle and passing the arguments to it. The function call by using function handle appears just like a function call using the function name.

 

 

>> cirarea(4)

ans =

50.2655

>> cirarea(1:4)

ans =

3.1416  12.5664  28.2743  50.2655

Posted Date: 10/20/2012 6:45:48 AM | Location : United States







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

Write discussion on Function cirarea - anonymous functions
Your posts are moderated
Related Questions
Use of built-in colormaps: MATLAB has built-in colormaps, it is also possible to generate others by using combinations of any colors. For illustration, the following generates

Structures: The Structures are data structures which group together values which are logically related in what are known as the fields of structure. The benefit of structures


Example of Plotting from a Function: For illustration, the function can be called as shown below:      >> y = [1:2:9].^3      y =     1  27  125  343  729

Technique to create Nested structures: This technique is the most proficient. Though, the other technique is to build the nested structure one field at a time. As this is a ne

Intersect function and setdiff function: The intersect function rather than returns all the values which can be found in both of the input argument vectors. >> intersect(v


Uses of Function handles: The Function handles can also be generated for functions other than anonymous functions, both built-in & user-defined functions. For illustration, th

Reading from a File in a While Loop: Though in most languages the combination of a loop and an if statement would be essential to determine whether or not the elements in a ve

analyzing traffic; determine motion of flow; calculate tracklets; detect abnormalities;