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
Run the MATLAB script sum = single(0); term = single(1); n=1; while sum + term > sum sum = sum+term; n=n+1; term = 1/n; end n Explain what you think it is trying to do. What wou

Customizing a Plot: Line Types, Color, Marker Types: Plots can be completed in the Command Window, if they are really simple. Though, at many times it is desirable to customiz

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

(a) Using Matlab, find and plot the magnitude of the DTFT of 10 samples of x(n) for n=[0:1:9] of x(n) = cos(2*pi*f1*n) + cos(2*pi*f2*n)  for f1=0.22 and f2=0.24 and pad zeros to ge

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

I need assignment to finish.

Illustration of script: For illustration, we will now generate a script known as script1.m which calculates area of the circle. It assigns a value for the radius, and then com

From A to B the inlet valve is open and the steam pressure increases linearly from 0.1000 MPa absolute to 15.00 MPa absolute, 1000°C. The inlet valve closes and from B to C the

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

Calculate the gray level value for all the pixels, Computer Graphics An 8x8 image f[i,j] has gray levels given by the following equation: f [i , j]= ? i-j ? ; i,j=0,1,2,3,4,5,6,7.