ODE response vs CCF response of mass-damper-spring system

1 次查看(过去 30 天)
Could someone please explain why is that the (zero-input) response obtained using ode45 solver is different than the CCF (controllable canonical form) response as shown below? However, if the C matrix is changed to [1 0], the responses match.
clear all
syms x(t)
x0 = [0;2];
m = 3;
b = 0.6;
k = 1.5;
Fa = 0;
eqn = m*diff(x,2) + b*diff(x,1) + k*x == Fa;
V = odeToVectorField(eqn);
M = matlabFunction(V,'vars',{'t','Y'});
ySol = ode45(M,[0 50],x0);
time = 0:0.1:50;
yValues_pos = deval(ySol,time,1);
s = tf('s');
G = 1/(m*s^2+b*s+k);
% CCF
Accf = [0, 1;
-k/m, -b/m];
Bccf = [0;
1];
Cccf = [1/m, 0];
Dccf = 0;
for i = 1:length(time)
yccf(i) = Cccf*expm(Accf*time(i))*x0;
end
figure()
hold on
plot(time,yccf,'b')
plot(time,yValues_pos,'r--')
legend('ccf','ODE45')
clear all
syms x(t)
x0 = [0;2];
m = 3;
b = 0.6;
k = 1.5;
Fa = 0;
eqn = m*diff(x,2) + b*diff(x,1) + k*x == Fa;
V = odeToVectorField(eqn);
M = matlabFunction(V,'vars',{'t','Y'});
ySol = ode45(M,[0 50],x0);
time = 0:0.1:50;
yValues_pos = deval(ySol,time,1);
s = tf('s');
G = 1/(m*s^2+b*s+k);
% CCF
Accf = [0, 1;
-k/m, -b/m];
Bccf = [0;
1];
Cccf = [1, 0];
Dccf = 0;
for i = 1:length(time)
yccf(i) = Cccf*expm(Accf*time(i))*x0;
end
figure()
hold on
plot(time,yccf,'b')
plot(time,yValues_pos,'r--')
legend('ccf','ODE45')

回答(1 个)

Sam Chak
Sam Chak 2023-2-2
编辑:Sam Chak 2023-2-2
Because the output matrix really means for this output equation
where is the output vector and is the state vector (come from your ODE).
Thus, if and , then it implies that the measured output is
.
In fact, the division by m only occurs at the dynamical level.
.
Solving this ODE returns the solution for the and , the states of the system.
So, if you want to compare the ODE result with the result using the state-space model, naturally you want to make for only or for both and .
  2 个评论
J AI
J AI 2023-2-2
My question - to be more precise - is that why the CCF has 1/m instead of 1 in the C matrix? Why does CCF scale the output by 1/m?
Sam Chak
Sam Chak 2023-2-2
As I explained previously, the division by m only occurs at the dynamical level; now as shown symbolically below. It is unnecessary to scale the output by , or .
syms x(t) m b k
x0 = [0;2];
% m = 3;
% b = 0.6;
% k = 1.5;
Fa = 0;
eqn = m*diff(x,2) + b*diff(x,1) + k*x == Fa;
V = odeToVectorField(eqn)
V = 

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by