Step response of a non-linear differential equation system
Step response of a non-linear differential equation system:
Responses to step inputs are frequently evaluated in process control either to model disturbances or to tune controllers. While Matlab has options to generate step response for linear systems, there seems to be no function to generate the step responses for non-linear ODE systems coded in Matlab (although this can be done in Simulink). The following function Step_ODE implements the response of the non-linear system states to the step changes in parameters of the model. The stepped parameters must be made as input arguments to the function describing the differential equations.
[t,y] = Step_ODE(fhan, Solver, t_s, t_t, Val_ini, Val_fin, ini)
------------------------------
Description of input arguments:
------------------------------
fhan - Function handle for the differential equation function
Solver - String name of the ODE solver
t_s - Step time
t_t - Total simulation time
Val_ini - Vector of initial values (before step) for the inputs or parameters
Val_fin - Vector of final values (after step) for the inputs or parameters
ini - Intial value vector for the differential equations
------------------------------
Example usage for a 2 state, 2 parameter system:
Val_ini = [0.3 0.4];
Val_fin = [0.5 0.1];
t_s = 150;
t_t = 300;
ini = [0 0];
Solver = 'ode23t';
fhan = @myfun;
[t,y] = Step_ODE(fhan, Solver, t_s, t_t, Val_ini, Val_fin, ini);
plot(t,y(:,1))
figure;
plot(t,y(:,2))
function dydt = myfun(~,y, Lam)
dydt = zeros(2,1);
dydt(1) = -Lam(1) * y(1) + 5 ;
dydt(2) = -Lam(2) * y(2) + 10 * y(1);
end
Periasamy Vijay
27/11/2017
Cite As
Vijay Periasamy (2024). Step response of a non-linear differential equation system (https://www.mathworks.com/matlabcentral/fileexchange/65201-step-response-of-a-non-linear-differential-equation-system), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 | Corrected help content in description
|