step response of non linear model
Show older comments
pls tell me clearly with MATLAB code...i am not comfortable with simulink. how to get the step respone of non-linear ODE for 3*3 MIMO boiler systems. the following are the equations.. i want the step response of the output not for the states.
x1dot = (-0.0018*u2*x1^(9/8)) + (0.9*u1) - (0.15*u3);
x2dot = ((((0.73*u2)-0.16)*x1^(9/8)-x2))/10;
x3dot = ((141*u3)-((1.1*u2)-0.19)*x1)/85;
y1 = x1;
y2 = x2;
y3 = 0.05*((0.13073*x3) + (100*((1-(0.001538*x3))*((0.8*x1)-25.6))/(x3*(1.0394-0.00123404*x1))) +(((((0.854*u2) -0.147)*x1) + (45.59*u1) -(2.514*u3) -2.096)/9) -67.975);
1 Comment
kruthika u
on 15 Dec 2023
Accepted Answer
More Answers (1)
Hi @kruthika u
For general nonlinear ODEs, you can refer to some examples in the ode45 documentation. To plot the state-dependent outputs, the idea is to first call ode45() to solve the ODEs and obtain the time responses of the state vector (x). Then, pass the time and state vectors as input arguments to the defined Output function to generate the time responses of the output vector (y). Two local functions, namely kruthikaODE() and kruthikaOut(), should be included at the end of the MATLAB script.
%% Task 1: Call ode45 to produce the state responses
tspan = [0 1];
x0 = [0; 0; 0];
[t, x] = ode45(@kruthikaODE, tspan, x0);
%% Task 2: Generate output vector using the Output function
for j = 1:numel(t)
y(j,:) = kruthikaOut(t(j), x(j,:));
end
%% Task 3: Plot Output responses
subplot(311)
plot(t, y(:,1)), grid on, ylabel('y_{1}')
subplot(312)
plot(t, y(:,2)), grid on, ylabel('y_{2}')
subplot(313)
plot(t, y(:,3)), grid on, ylabel('y_{3}'), xlabel('t')
% Place local functions at the end of Main script (after the 3 tasks)
%% ODE function
function xdot = kruthikaODE(t, x)
% initialzation
xdot = zeros(3, 1);
% definitions
x1 = x(1);
x2 = x(2);
x3 = x(3);
% step functions
u1 = (t >= 0)*1;
u2 = u1;
u3 = u2;
% Original ODEs
xdot(1) = (-0.0018*u2*x1^(9/8)) + (0.9*u1) - (0.15*u3);
xdot(2) = ((((0.73*u2)-0.16)*x1^(9/8)-x2))/10;
xdot(3) = ((141*u3)-((1.1*u2)-0.19)*x1)/85;
end
%% Output function
function y = kruthikaOut(t, x)
% initialzation
y = zeros(3, 1);
% definitions
x1 = x(:,1);
x2 = x(:,2);
x3 = x(:,3);
% step functions
u1 = (t >= 0)*1;
u2 = u1;
u3 = u2;
% Outputs
y(1) = x1;
y(2) = x2;
y(3) = 0.05*((0.13073*x3) + (100*((1-(0.001538*x3))*((0.8*x1)-25.6))/(x3*(1.0394-0.00123404*x1))) +(((((0.854*u2) -0.147)*x1) + (45.59*u1) -(2.514*u3) -2.096)/9) -67.975);
end
1 Comment
kruthika u
on 14 Dec 2023
Moved: Sam Chak
on 16 Dec 2023
Categories
Find more on Passivity and Sector Bounds in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


