Question: ME021 - Engineering Computing - Fall 2017 Assignment HW 10 (Matlab) Due the week of November 6,2nd lab session Matlab Function Optional Parameter Values Matlab

ME021 - Engineering Computing - Fall 2017 Assignment HW 10 (Matlab) Due the week of November 6,2nd lab session Matlab Function Optional Parameter Values Matlab functions can assume default values if the function is called with no value for a given parameter. We see something similar in the plot function. If we call plot (x,y,c) then Matlab plots y versus x with the values given in the c string for things like line color, marker shape, line type, etc. But, if we call plot (x,y), then Matlab plots y versus x and just uses the defaults for c. There is a parameter available inside functions called nargin. It stores the number of parameters ("arguments") that were passed to the function. We can use that to have the function do different things (such as assign default values) depending on the number of parameters that were passed to the function. Here is an example function. h PlotilthLabel
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
