In my real system, ss2 is my plant model, and ss1 is a disturbance acting on the system.
K would be the feedforward 'gain'.
So by taking 'K = -inv(ss2)*ss1', K would be the optimal feedforward gain, and the resulting output (after the sum) should be equal to zero.
The state-spaces are too big (100+ states) to use the function ss2tf. When I use this function, the coefficients in the tf become too large for MATLAB. That is the reason why I am using state spaces instead of transfer functions.
P.S. Just checked with simple TF's, and it does work then (sum is equal to 10^-15 = 0).