Passing multiple arguments, MATLAB Programming

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

Posted Date: 10/18/2012 7:24:11 AM | Location : United States







Related Discussions:- Passing multiple arguments, Assignment Help, Ask Question on Passing multiple arguments, Get Answer, Expert's Help, Passing multiple arguments Discussions

Write discussion on Passing multiple arguments
Your posts are moderated
Related Questions
To accept two numbers from the user; Display all prime numbers between these two numbers.

I have a file to be read in matlab which carries different columns in it. Each column has around 200000 readings in set of 2000. I want a code in a loop which gives stores each col

Create a text file with simulated data. Calculate an experimental y using the first function and some reasonable values for the parameters Add noise Save the x values and ca

hi, I would like to get quote for my matlab assignment help? thanks

what are the difference between a.linear permutation b.circular permutation

i need help with a monte carlo simulation. I have most of the code, but I can''t get it to plot correctly

How to make EMG analysis by Matlab?

Plot way forms for the following modulation schemes using Mathlab: a)      2 ASK                     b)  BFSK                        c) BPSK 4 ASK

convolve the following sequences using tabulation method and verify the same using matrix mmethhod

Find f(t) for each F(s): Problem: Based on an examination given to a large class in which the maximum score is 100 points, assuming that 20 grades taken at random f