Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How can I use the coupled system of matrices (ODE45) using a frequency span?
조회 수: 2 (최근 30일)
이전 댓글 표시
I haven't found much information in the Documentation addressing a case like this, so I'm unsure of where to even begin.
The following system of equations is put into matrix notation (presumably correctly done).
I'm trying to use ODE45 to solve and plot this system on a frequency span of 50 to 200 Hz.
% Matrices shown above (Corresponding x1 values 1st column & x2 in the 2nd.)
f = 50:1:200; % Frequency (Hz)
A = [23.3 0; 0 240];
B = [-5926 4566; -11133 4566];
C = [-4 0.39; 0.39 -1.34];
D = [0; -1(2 * pi * f)];
댓글 수: 0
답변 (1개)
Ameer Hamza
2020년 6월 12일
There is no 'f' term in this system of ODE. Following shows how to solve this using ode45
t = linspace(0, 10, 1000); % solve the equation for t in [0, 10]
ic = [0; 0; 0; 0]; % initial condition
[t, y] = ode45(@(t, x) odeFun(t, x), t, ic);
subplot(2,2,1)
plot(t, y(:,1))
title('x1')
subplot(2,2,2)
plot(t, y(:,2))
title('x2')
subplot(2,2,3)
plot(t, y(:,3))
title('x1dot')
subplot(2,2,4)
plot(t, y(:,4))
title('x2dot')
function dxdt = odeFun(t, x)
% x(1)=>x1, x(2)=>x2, x(3)=>x1', x(4)=>x2'
dxdt = zeros(4, 1);
dxdt(1) = x(3);
dxdt(2) = x(4);
dxdt(3) = 1/23.3*(5926*x(3) - 4566*x(4) + 4*x(1) - 0.39*x(2));
dxdt(3) = 1/240*(-4566*x(3) + 11133*x(4) - 0.39*x(1) + 1.34*x(2) - 1);
end
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!