Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How can I use the coupled system of matrices (ODE45) using a frequency span?

1 Ansicht (letzte 30 Tage)
Keith Grey
Keith Grey am 11 Jun. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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)];

Antworten (1)

Ameer Hamza
Ameer Hamza am 12 Jun. 2020
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

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by