I am working with a 30-state, 14-input linear model that is described by a state-space model:
model_state_space = ss(A, B, C, D);
The model is extremely slow (it describes the thermal behavior of a building), so when I discretize it I choose a sample time of 900 seconds and plot the step response from one of the inputs:
[y,t] = step(model_state_space);
plot(t, y(:,:,end))
I obtain a similar plot when I compute the step response of the discretized state-space model, or of the equivalent transfer function continuous model:
hold on
[y,t] = step(c2d(model_state_space, 900));
plot(t,y(:,:,end), 'r')
[y,t] = step(tf(model_state_space));
plot(t,y(:,:,end), 'k')
But when I compute the impulse response of the discretized transfer function, the system appears unstable:
[y,t] = step(c2d(tf(model_state_space), 900));
plot(t,y(:,:,end), 'g')
Can someone please explain why this is so?