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
deblank function: The deblank function eliminates only trailing blanks from the string, not leading the blanks. The strtrim function will eliminate both the leading and traili

Finding products by for loop: an illustration, when 5 is passed to be the value of the input argument n, the function will compute and return 1 + 2 + 3 + 4 + 5, or 15: >> s

Vectors of Structures: In numerous applications, involving database applications, information generally would be stored in the vector of structures, instead of in individual s

Creating Cell arrays: There are many ways to create cell arrays. For illustration, we will create a cell array in which one element will store an integer, one element store ch

Interpolation and extrapolation: In most cases, it is desired to estimate values other than at the sampled data points. For illustration, we may want to estimate what the temp

Dot Product: The dot or inner product of two vectors a and b is written as a • b and is defined as  In another words, this is like matrix multiplication when multiplyi

Example of Interpolation and extrapolation: The MATLAB has a function to do this, known as polyfit. The function polyfit finds the coefficients of the polynomial of the partic

Help command: The help command is used with the script rectarea, the function readlenwid, and the major function printrectarea. To see the first comment in the subfunction, as

Interchange rows : for illustration interchanging rows ri and rj is written as

. Generate the following signal, x(n)=1+cos((25*pi*n)/100),0 Compute the DTFT of x[n] for w=0:0.01:2*pi Plot the Real part, imaginary part, the amplitude and phas