MATLAB Answers

zk1998
0

Determine if an array has any elements that are zero ?

Asked by zk1998
on 17 Mar 2019
Latest activity Edited by dpb
on 17 Mar 2019
Accepted Answer by dpb
Hello I am trying to write a function file that will take a row vector representing a polynomial and return a 0 if it at least one of the coefficents of the polynomail is zero and a 1 if otherwise.
Many thanks in advance.

  0 Comments

Sign in to comment.

1 Answer

Answer by dpb
on 17 Mar 2019
Edited by dpb
on 17 Mar 2019
 Accepted Answer

function flg = isFullPoly(b)
% isFullPoly(b) returns T if all coefficients, b, nonzero, F otherwise
flg=all(b);
end
This one really doesn't need a function for other than "syntactic sugar" to indicate what are testing which a comment could do as well...but, nothing really wrong with doing so if wish...

  0 Comments

Sign in to comment.