Hi Ram,
I understand that you are looking for different methods to obtain the response of a state-space model in MATLAB, including using built-in functions like "lsim" and numerical methods such as the Runge-Kutta method.
I assume you have a state-space representation of your system and are interested in both analytical and numerical methods for response analysis.
In order to obtain the response of a state-space model, you can follow the below steps:
Define the State-Space Model:
Use the "ss" function to define your state-space model with matrices A, B, C, and D.
Simulate the Response with "lsim":
Use "lsim" to simulate the system's response to a custom input signal over a specified time period.
[y, t, x] = lsim(sys, u, t);
plot(t, y), title('Response using lsim'), xlabel('Time'), ylabel('Output');
Implement the Runge-Kutta Method:
Numerically solve the state equations using the Runge-Kutta method for a given input signal.
k2 = A(x(:, i) + 0.5dtk1) + Bu(i);
x(:, i+1) = x(:, i) + dt*k2;
plot(t, y_rk), title('Response using Runge-Kutta'), xlabel('Time'), ylabel('Output');
Use Other Built-in Functions:
Explore other functions like "step" for step response and "impulse" for impulse response.
Compare and Analyze:
Compare the results from different methods to ensure consistency and accuracy of the responses.
plot(t, y, 'b', t, y_rk, 'r--');
legend('lsim', 'Runge-Kutta');
Refer to the documentation of "lsim" function to know more about the properties supported: https://www.mathworks.com/help/control/ref/lsim.html
Hope this helps!