Calling another .m file function

1 次查看(过去 30 天)
Mughees Asif
Mughees Asif 2019-3-19
评论: dpb 2019-3-19
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 个评论
dpb
dpb 2019-3-19
  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

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by