Calling another .m file function

1 view (last 30 days)
Mughees Asif
Mughees Asif on 19 Mar 2019
Commented: dpb on 19 Mar 2019
function IsStable(polynomial)
AllNonZero(polynomial)
AllSameSign(polynomial)
length(polynomial);
while 1i==1:polynomial
minor(1i)=det(polynomial(1:1i,1:1i))
if minor(1i)>0
true()
HurwitzMatrix(polynomial)
else
false()
end
end
end
The above function file should first check if the polynomial coefficients are the same sign and all elements are non-zero. I have used .m files with embedded functions for the previously mentioned steps. It is also meant to return the Hurwitz matrix when it has been calculated and an empty matrix if any condition is not met. When checking whether all principal minors are positive, I am trying to use a while loop and stop the checking when a negative or zero principal minor is encountered.
Any suggestions on how to achieve this as succintly as possible as my code is just not working after the checking of the 2 .m files? Thank you.
  1 Comment
dpb
dpb on 19 Mar 2019
  1. You call two functions but neither returns anything so they have absolutely no effect inside this function.
  2. Inside the while loop you call either true or false but again result isn't assigned to anything so has no effect other than echo to command line
  3. Same issue as 1) with the other function HurwitzMatrix

Sign in to comment.

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!