How to deal with the time response of first order system?

4 visualizaciones (últimos 30 días)
Cola
Cola el 21 de Abr. de 2022
Comentada: Cola el 21 de Abr. de 2022
There is a system of differential equations:
x'=ax+by,
y'=cx+dy,
where tau*a'+a=a*. I used to deal with the time response tau in simulink.
Now how to deal with the time response of first order system in matlab by code? Is there a way to solve the problem? Thank you.

Respuesta aceptada

Sam Chak
Sam Chak el 21 de Abr. de 2022
@Cola, let's correct your Simulink model first.
The ODE is given by
which can be rearranged into
Integrating both sides and is obtained:
Technically it means that the signal after the integrator block (1/s) is , and that is the output of the system.
To obtain , you need to properly get the integrand, a function that is to be integrated:
So you should perform the subtraction first, and then it multiply with using the Gain block. The signal from the Gain block is fed into the Integrator block (1/s).
If , then the MATLAB code looks something like this:
tau = 1;
% 1st-order Ordinary differential equation
fcn = @(t, x) [(1 - x)/tau];
tspan = [0 10];
init = 0; % initial condition
% Runge-Kutta Dormand-Prince 4/5 solver
[t, x] = ode45(fcn, tspan, init);
plot(t, x)
grid on
xlabel('t')
ylabel('a(t)')
title('Time response of the system')
Result:
  1 comentario
Cola
Cola el 21 de Abr. de 2022
@Sam Chak Thank you very much. Your answer is so good and detailed. Thus we can deal with the problem by solving the ODE.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Discontinuities en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by