find partial terms in symbolic expressions in matlab

Viewed 25

I have a vector of symbolic expressions like this in matlab:

eqn = k*r*t0*Lp+k*t0*(r*Li+La)+In -Ic;

I'd like to find the expression(k*r).Any idea how can I do that? Thanks! simple example:

a+b+c+d = 0;

I'd like to find the expression(a+c),then:

a+c = -(b+d); 
1 Answers

You want to isolate k*r, so.... do that!

syms k r t0 Lp Li La In Ic
eqn = k*r*t0*Lp+k*t0*(r*Li+La)+In -Ic==0;
isolate(expand(eqn),k*r) % for some reason this case did not work without expand()

ans =
 
k*r == -(In - Ic + La*k*t0)/(Li*t0 + Lp*t0)
Related