Filter löschen
Filter löschen

Calling another .m file function

1 Ansicht (letzte 30 Tage)
Mughees Asif
Mughees Asif am 19 Mär. 2019
Kommentiert: dpb am 19 Mär. 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 Kommentar
dpb
dpb am 19 Mär. 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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by