Trying to use simplify with an equation equal to zero.
19 views (last 30 days)
Show older comments
I'm sorry if this has been asked previously. I've tried searching and can't seem to find this scenario though I can't imagine I'm the first person to have this issue. Here's the code I'm working with, this is for a control systems problem...
syms s k
sys = k*(s-1)*(s-2)/(s*(s+1));
sysEqn = 1+sys ==0;
routh_func = simplify(sysEqn)
I'm getting the output I want...
Routh Function
2 2
2 k + s - 3 k s + k s + s == 0
I want to the extract the coefficients [(1+k,1-3k,2k)] to be used with a Routh function. The problem I'm running in to is that the "== 0" needs to be removed and is stopping me from using something like this...
routh_coeffs = coeffs(routh_func)
syms epsilon
RA = routh(routh_coeffs,epsilon)
To discern the routh table. Yes I know routh isn't a built in function, credit to Author:Rivera-Santos, Edmundo J. E-mail:edmundo@alum.mit.edu. For the routh function (downloaded from these forums!).
Any help would be greatly appreciated. Thank you!
0 Comments
Accepted Answer
Star Strider
on 22 Oct 2014
The Symbolic Math Toolbox assumes zero, so it’s not necessary to state it explicitly.
This will get you the coefficients:
syms s k
sys = k*(s-1)*(s-2)/(s*(s+1));
sysEqn = 1+sys;
[routh_func,den] = numden(sysEqn)
routh_coeffs = coeffs(routh_func, s)
2 Comments
Star Strider
on 22 Oct 2014
My pleasure!
I admire your courage in tackling classical control problems!
More Answers (0)
See Also
Categories
Find more on Stability Analysis 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!