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

Logical operators, logical operators: The logical operators are as sho...

logical operators: The logical operators are as shown below: All the logical operators operate on Boolean or logical operands. The not operator is a unary operator; wh

Compute a reasonable vector for lower bound and upper bond, You are a quant...

You are a quant analyst reporting directly to a portfolio manager. Your manager requires you to generate a simple code to compute several statistics for the following potential por

Transportation problem, I want codding in matlab for vogel approximation me...

I want codding in matlab for vogel approximation method . i mean .M file for vogels approximation method.

Need urgent help, i want to save the values of a particular equation in a f...

i want to save the values of a particular equation in a for loop.. for ex: for i=1:100 et=(x+yz); end thus how can i store the values of et at each iteration

Order of precedence - operator, Order of precedence: As with the numer...

Order of precedence: As with the numerical operators, it is significant to know that the operator precedence rules. Table below shows the rules for the operators which  have b

CAlculus, kind in geometric calculity in space AREA. >

kind in geometric calculity in space AREA. >

Ray tracing equations, i want to write a program in mat lab for optimizing ...

i want to write a program in mat lab for optimizing the design of lens help me how could i i am new user of matlab but previously i have work on C++.

Plot the poles and zeros of the filter using zplane, A filter described by ...

A filter described by the equation:    y(n) = x(n) + x(n-1) + 0.9 y(n-1) - 0.81 y(n-2) (a) Find the transfer function H(z) for the filter and find the poles and zeros of the fil

Design and implement binary digital modulation, Design and implement Binary...

Design and implement Binary digital modulation for a specific input signal frequency, sampling frequency and signal level for binary frequency shift keying (BFSK) by applying MATLA

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