Passing multiple arguments, MATLAB Programming

Assignment Help:

Passing Multiple Arguments:

In many situaion it is essential to pass more than one argument to the function. For illustration, the volume of a cone is given by

120_Passing Multiple Arguments.png

here r is the radius of the circular base & h is the height of cone. Hence, a function which computes the volume of a cone requires both the radius and the height:

 

728_Passing Multiple Arguments1.png

As the function has two input arguments in function header, the two values should be passed to the function when it is called. The order makes a dissimilarity.The initial value which is passed to the function is stored in the initial input argument (in this situation, radius), and the next argument in the function call is passed to the next input argument in the function header.This is very important: The arguments in the function call should correspond one-to-one with the input arguments in the function header.

Here is an illustration of calling a function. The answer returned from the function is easily stored in the default variable ans.

>> conevol (4,6.1)

ans =

102.2065

In the next illustration, the result is printed rather with the format of two decimal places.

>> fprintf('The cone volume is %.2f\n',...

conevol(3, 5.5))

The volume of the cone is 51.84


Related Discussions:- Passing multiple arguments

Wavelet transform, Explain how the wavelet transform based on the real bior...

Explain how the wavelet transform based on the real biorthogonal "decomposition" wavelet bior 1.5 (the wavelet shape by typing waveinfo ('bior') at the MATLAB command prompt) can

Image processing, i am doing my project on matlab and the topic of my proje...

i am doing my project on matlab and the topic of my project is invisible watermarking.How we can extract all pixel values of image in binary form.

Statistically stationary environment, For a statistically stationary enviro...

For a statistically stationary environment it would be advantageous to use gear shifting, that is to reduce the adaptation gain with time. To illustrate this, try using a varying a

Matlab scripts, Matlab Scripts: Once a problem has been examined, and ...

Matlab Scripts: Once a problem has been examined, and the algorithm for its answer has been refined and written, the algorithm then is translated into the specific programming

#title.matrix, #defining matrix using only special commands

#defining matrix using only special commands

First order differential equations, First order differential equations: Eul...

First order differential equations: Euler's method Finally, we consider ?nding the numerical solution for a ?rst order differential equation given an initial value. We consider

Function char - characters and encoding, Function char: The function c...

Function char: The function char does the opposite; it converts from any number type to the type char: >> char(numequiv) ans = a As the letters of the alphabet are

Various commands for get the help, Various commands for get the help: T...

Various commands for get the help: There are various commands which can serve as an introduction to MATLAB and allow you to get the help: info will show contact informatio

Earth''s magnetic field, to plot Earth''s magnetic field on world map in ma...

to plot Earth''s magnetic field on world map in matlab

Write a matlab function, There are many approaches to numerically estimatin...

There are many approaches to numerically estimating the derivative of the function.  The relationship:   is called a forward difference, since the estimate of the derivativ

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