Reputation: 5157
Does anyone know how to get Octave to combine fractions in the symbolic package? For example, I would like to make "1+1/s"
rewritten as "(s^2 + 1)/s"
.
My reason is that I want to get zeros and poles of frequency domain expressions into the right place in the rational expression. The above is a very simple example of a more complicated use case, typically with lots of R, L, C constants.
Upvotes: 0
Views: 709
Reputation: 10792
You can use the function factor()
, in this case it will simply put the whole expression with the same common denominator:
syms x,s
x = 1+1/s
res = factor(x)
and
res =
s + 1
─────
s
Upvotes: 1