Function cirarea - anonymous functions, MATLAB in Engineering

Assignment Help:

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


Related Discussions:- Function cirarea - anonymous functions

Matrix solutions of the linear algebraic equation, Matrix solutions to syst...

Matrix solutions to systems of the linear algebraic equations: The linear algebraic equation is an equation of the form a 1 x 1 + a 2 x 2 + a 3 x 3    .  .  .  .  a n x n

Sorting vectors of structures, Sorting Vectors of structures: Whenever...

Sorting Vectors of structures: Whenever working with vector of structures, it is very common to sort based on a particular field within the structures. For illustration, recal

Illustration of if - else statement, Illustration of if - else statement: ...

Illustration of if - else statement: The one application of an if-else statement is to check for errors in the inputs to a script. For illustration, a former script prompted t

Creating the structure variables, Creating the structure Variables: Cr...

Creating the structure Variables: Creating a structure variable can be accomplished by simply storing the values in fields by using assignment statements, or by using the stru

Matrix operations, Matrix operations: There are some common operations...

Matrix operations: There are some common operations on matrices. The operators which are applied term by term, implying that the matrices should be of similar size, sometimes

Preallocating a vector, Preallocating a Vector: There are necessarily ...

Preallocating a Vector: There are necessarily two programming techniques that can be used to simulate the cumsum function. One technique is to begin with an empty vector and c

Ischar function - string, ischar function: The ischar function return ...

ischar function: The ischar function return the logical true if an array is a character array, or logical false if not. >> vec = 'EK127'; >> ischar(vec) ans =

Creating a cell array - assign values to array, Creating a cell array: ...

Creating a cell array: The other method of creating a cell array is easy to assign values to particular array elements and build it up element by element. Though, as explained

Finding sums by for loop, Finding sums and products: A very general ap...

Finding sums and products: A very general application of a for loop is to compute sums and products. For illustration, rather than of just printing the integers 1 through 5, w

Expanding a function, Expanding a function: The expand function will m...

Expanding a function: The expand function will multiply out terms, and factor will do the opposite: >> expand((x+2)*(x-1)) ans = x^2 x-2 >> factor(ans)

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd