Hi Ashwini,
It appears the issue you are having is with the input vector that you are passing into the "lsim" function. When you create the space-space model with the "ss" function, your inputs (e, f, g, and h) specify the number of states (Nx), number of inputs (Nu), and number of outputs (Ny) for the model. Specifically, e is an Nx-by-Nx matrix; f has size Nx-by-Nu; g has size Ny-by-Nx; and h has size Ny-by-Nu. Here, you have specified the model to have 3 inputs, 3 outputs, and 3 states, since all of the input matrices are 3x3. So when you simulate the response of the system to an input, your input's size must satisfy what the model expects.
Here, for your input signal, the number of rows must match the number of time samples (101), and the number of columns must match the number of input channels for the model (3). So make a new input matrix that is 101x3 instead of 101x1 like your input signal 'u' is. You can try something like this:
% Use the square signal in 'u' as the signal for each input channel
U = [u,u,u];
lsim(sys,U,t)
I hope this helps!
Matt