MATLAB: Work out a large expression

expression

I don't know what the exact terms are for such a thing so i could not google it. Thats why I am asking it here. I have the following expression:
0 = -V1*R^3-V2*Z1*R+V2*R^2-V2*R^2*Z1+V2*Z1*Z2-V1*Z1*Z2 + V2*Z1^2*R;
Where R = 10000
Z1 = 1/(s*c)
Z2 = 1/(s*2*c)
with c = 1*10^-6
s is jw (I need to get a transfer function)
Is there a way in Matlab that I can work out this expression(Or similar expressions) to get V2/V1?
I did this manually but It I dont get the desired results so I wanted to see if there is a way in Matlab to do this so i can check it.
When I just fill this in I get the errors that V1, V2 and s are unrecognised variables. Because i dont know any values for these. Is there a way to get around this?
Thanks in advance

Best Answer

Here's one way
syms s Z1 Z2 vr
R = 10000;
c = 1e-6;
Z1 = 1/(s*c);
Z2 = 1/(s*2*c);
% 0 = -V1*R^3-V2*Z1*R+V2*R^2-V2*R^2*Z1+V2*Z1*Z2-V1*Z1*Z2 + V2*Z1^2*R;
% Dividing through by V1, and setting vr = V2/V1 we get
eqn = 0 == -R^3 - Z1*R*vr + R^2*vr -Z1*R^2*vr + Z1*Z2*vr - Z1*Z2 + Z1^2*R*vr;
vr = solve(eqn,vr);
pretty(vr)