Illustration of variable number of input arguments, MATLAB Programming

Illustration of Variable number of input arguments:

In this situation, it was supposed that the radius will always be passed to the function. The function header can hence be modified to specify that the radius will be passed, and then a variable number of the remaining input arguments (either no one or one):

640_Illustration of Variable number of input arguments.png

>> areafori2(1,'i')

ans =

  452.3893

>> areafori2(3)

ans =

  28.2743

Note that the nargin returns total number of input arguments, not merely the number of the arguments in cell array varargin.

 

Posted Date: 10/22/2012 1:17:55 AM | Location : United States







Related Discussions:- Illustration of variable number of input arguments, Assignment Help, Ask Question on Illustration of variable number of input arguments, Get Answer, Expert's Help, Illustration of variable number of input arguments Discussions

Write discussion on Illustration of variable number of input arguments
Your posts are moderated
Related Questions
Example of variable names: If nothing appears when, who or whose is entered, which means there aren't any variables! For illustration, in the starting of a MATLAB session, the

The Programming Concept: In most of the programming languages, random function returns a real number; therefore the real number would then have to be rounded to produce a rand

To accept two numbers from the user; Display all prime numbers between these two numbers.

Illustration of Variable number of input arguments: In this situation, it was supposed that the radius will always be passed to the function. The function header can hence be

function y=tps(r) % This is the thin-plate spline if r  y=0; else  y=r^2*log(r); end function y=fun(point) % my target function x=point(1); z=point(2); y=7-4*x^2+z^3;

what is matlab

This assignment is designed to compare performance between Matlab and Excel for performing nonlinear regression analysis of a set of data. There are two data sets in the accompa

Produce a random real number: To produce a random real number in the range from low to high, at first create the variables low and high. And then, use the expression rand*(hig

Write a Matlab function that computes y1= tan(x) and y2= sin(x)/cos(x), returns the difference |y1-y2| and prints a message whether the two are equal or not. Test your function for

Problem: Consider a trapezoidal piece of polymer film as shown below. The parallel sides of the trapezoid are insulated and the temperature of the bottom and diagonal sides are f