Filter löschen
Filter löschen

Info

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

How to solve system of 2nd order differential equations using ode23 or ode45.

1 Ansicht (letzte 30 Tage)
Jesse Crotts
Jesse Crotts am 9 Dez. 2018
Geschlossen: madhan ravi am 9 Dez. 2018
I'm trying to use ode23 or ode45 to solve a system of 2nd order differential equations that look like this:
[M]*xdotdot+[K]*x=[Q]
where M and K are 10x10 matrices and Q is a 10x1 matrix.
I would appreciate any help with it.
Here is the same problem I have been working on with 2x2 matrices but cant get it to work either:
clc; clear
figure
time = (0:.001:22.5)';
M = [1 2; 3 4];
K = [5 6; 7 8];
x0 = [0;0;0;0]; %[position,velocity]
[t1,x1,x2,x3,x4]=ode23(@(t1,x) trick(t1,x,M,K), time, x0);
plot(t1,x(:,1));
xlabel('Time(sec)');
ylabel('Displacement');
title('Stepped Response(Underdamped)');
This function calls trick:
%2x2 sys
function f = trick(t,x,M,K)
f = zeros(4,1);
f(1) = x(2);
f(2) = x(3);
MinvnegK = -inv(M)*K;
delta = MinvnegK*[x(4) x(5)]';
f(3) = delta(1);
f(4) = delta(2);

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by