Skip to content

nargout

Number of output arguments

nargout

  • It returns the number of output arguments of a user-defined funciton.
  • It has to be called within a user-defined function.

Example 1: Plotting the polynomial having roots [3 4 5].

r=[3 4 5];
p=poly(r);
x=linspace(2.8,5.5);
plot(x,polyval(p,x))
p =
1.000  -12.00   47.00  -60.00

Plot is generated.

Plot

Example 2: Coefficients of characteristic polynomial of a matrix.

A=[1 2;3 4];
p=poly(A)
p =
1.000  -5.000  -2.000