Borrar filtros
Borrar filtros

Calling another .m file function

1 visualización (últimos 30 días)
Mughees Asif
Mughees Asif el 19 de Mzo. de 2019
Comentada: dpb el 19 de Mzo. de 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 comentario
dpb
dpb el 19 de Mzo. de 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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by