4*4 reverse matrix code in matlab wich has variables
Matlab Symbolic toolbox can be used.
syms s m1 mq b k1 kq

m = [s, -1, 0, 0;
  (kq+k1)/m1, s+b/m1, -kq/m1, -b/m1;
  sym(0), 0, s, -1;
  -kq/mq, -b/mq, (kq-k1)/mq, s+b/mq]

inv(m)
% OR
m\eye(4)

The result may not be the simplest possible expression though.
I tried the above code in Octave