second order to first order

3 visualizaciones (últimos 30 días)
Cesar Cardenas
Cesar Cardenas el 23 de Ag. de 2022
Respondida: Cesar Cardenas el 24 de Ag. de 2022
Hello, I'm trying to convert this system to as described here:
This is my attempt but not sure...any help will be greatly appreciated. Thanks
syms x(t)
eqn = diff(x,2) + diff(x,t)*x == u;
V = odeToVectorField(eqn)

Respuesta aceptada

Sam Chak
Sam Chak el 24 de Ag. de 2022
I suspect that your 2nd-order ODE was incorrectly written. Please check. If it is a linear damped spring system, then the equation should be:
and it can be converted to the state-space form as shown below:
omega = 2;
zeta = sqrt(3)/4;
sympref('AbbreviateOutput', false);
syms x(t) y(t) u
eqn = diff(x, 2) + 2*zeta*omega*diff(x) + (omega^2)*x == (omega^2)*u;
[V, S] = odeToVectorField(eqn)
V = 
S = 
From the result, and , and so, the state-space model can be constructed accordingly:
A = [0 1; -4 -sqrt(3)];
B = [0; 4];
C = [1 0];
D = 0;
sys = ss(A, B, C, D)
sys = A = x1 x2 x1 0 1 x2 -4 -1.732 B = u1 x1 0 x2 4 C = x1 x2 y1 1 0 D = u1 y1 0 Continuous-time state-space model.

Más respuestas (1)

Cesar Cardenas
Cesar Cardenas el 24 de Ag. de 2022
Hi @Sam Chak, thanks much for your help. I think it is a damped spring system. I would have an additional question.
For part c (based on the image below), this is my attempt: (not sure though). and do not really know how to work out part d regarding discrete time histories. Could you please give me any clue?? Thanks much once again.
%x(t) = 0.5*x(k-1) + y(k-1)
%y(t) = -0.5*x(k) + y(k)
%x(1) = 1, y(1) = 1
timesteps=30;
x = zeros(1, timesteps);
y = zeros(1, timesteps);
x(1) = 1;
y(1) = 1;
for k=2:timesteps
x(k) = 0.5*x(k-1) + y(k-1);
y(k) = -0.5*x(k) + y(k);
end
plot(1:timesteps,x, '-b', 'Linewidth' ,3);
hold on
plot(1:timesteps,y,'--r', 'Linewidth',3);
xlabel('time');
ylabel('Quantity')
legend('x','y')
figure(2)
plot(x,y)
xlabel('x')
ylabel('y')

Categorías

Más información sobre Numerical Integration and Differential Equations 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