- You call two functions but neither returns anything so they have absolutely no effect inside this function.
- 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
- Same issue as 1) with the other function HurwitzMatrix
Calling another .m file function
1 次查看(过去 30 天)
显示 更早的评论
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
2019-3-19
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!