필터 지우기
필터 지우기

second order to first order

조회 수: 3 (최근 30일)
Cesar Cardenas
Cesar Cardenas 2022년 8월 23일
답변: Cesar Cardenas 2022년 8월 24일
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)

채택된 답변

Sam Chak
Sam Chak 2022년 8월 24일
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.

추가 답변 (1개)

Cesar Cardenas
Cesar Cardenas 2022년 8월 24일
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')

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by