As =

Given that no original MATLAB code for the nonlinear system is provided, I believe it would be more efficient for me to derive the linear state-space matrices intuitively by hand. If my derivation is correct, you should obtain the following symbolic state matrix :

syms m1 m2 c1 c2 c3 k1 k2 k3

%% symbolic state matrix

As = [zeros(2), eye(2);

-(k1+k2)/m1, k2/m1, -(c1+c2)/m1, 0;

k2/m2, -(k2+k3)/m2, 0, -(c2+c3)/m2]

%% symbolic input matrix

Bs = [sym('0'); sym('0'); sym('1'); sym('0')]

%% State-space model

A = matlabFunction(As);

B = matlabFunction(Bs);

C = eye(4);

D = 0;

m1 = 1;

m2 = 1;

c1 = 1;

c2 = 1;

c3 = 1;

k1 = 1;

k2 = 1;

k3 = 1;

sys = ss(A(c1,c2,c3,k1,k2,k3,m1,m2), B(), C, D)

%% Step response

step(sys), grid on