ODE solver for second Order ODE with Stiffness and Mass Matrices

In summary, the conversation is about using MATLAB and ODE45 to solve a second order differential equation written in matrix form. The user is seeking help on how to write the code for it and is also given information on necessary initial conditions. The conversation also includes a similar example problem and solution code.
  • #1
ihebmtir
3
0
TL;DR Summary
i have encoutered this Problem where i need to solve an ordinary differential Equation using ODE45 for M*u''+K*u=f(t)
i am new to MATLAB and and as shown below I have a second order differential equation M*u''+K*u=F(t) where M is the mass matrix and K is the stifness matrix and u is the displacement.
and i have to write a code for MATLAB using ODE45 to get a solution for u. there was not so much information on how to solve an ODE that´'s written on Matrix form, i would be really thankful for you help
 

Attachments

  • frage.png
    frage.png
    4.5 KB · Views: 145
Engineering news on Phys.org
  • #2
Do you have a definition for the vector {f(t)}?
 
  • #3
yes F(t)=[F0*sin(w*t), 0, 0, 0]
and Both M and K are 4X4 Matrices
 
  • #4
Obviously you will need some initial conditions as well. I will attach a similar example problem and solution code.

It can be a little tricky getting the code to run. You should save the lower function in a separate script (called "f" in this case - since that's what the ode45 function calls) in the working folder. The upper part is what you will run and it calls the other function. There's probably a more elegant way of doing it, but I don't know it.
1624567411995.png

1624567424651.png

xo=[0; 0.1; 1; 0];
ts=[0 20];
[t,x]=ode45('f',ts,xo);
plot(t,x(:,1),t,x(:,2),'--')
%------------------------------------------
function v=f(t,x)
M=[2 0; 0 1];
C=[3 -0.5; -0.5 0.5];
K=[3 -1; -1 1];
B=[1; 1];
w=2;
A1=[zeros(2) eye(2); -inv(M)*K -inv(M)*C];
f=inv(M)*B;
v=A1*x+[0;0; f]*sin(w*t);
 

FAQ: ODE solver for second Order ODE with Stiffness and Mass Matrices

What is an ODE solver?

An ODE (ordinary differential equation) solver is a mathematical tool used to approximate the solution of a differential equation. It involves breaking down a complex differential equation into smaller, simpler equations that can be solved using numerical methods.

What is a second order ODE?

A second order ODE is a differential equation that involves a second derivative of a function. It can be written in the form of y'' = f(x,y,y'). This type of ODE is commonly used to model physical systems in science and engineering.

What is the significance of stiffness and mass matrices in a second order ODE?

Stiffness and mass matrices are used to describe the properties of a physical system in a second order ODE. The stiffness matrix represents the resistance of a system to deformation, while the mass matrix represents the inertia of the system. These matrices are essential for accurately solving the ODE and obtaining a realistic solution.

How does an ODE solver handle stiffness and mass matrices?

An ODE solver for second order ODEs with stiffness and mass matrices uses advanced numerical methods to handle the stiffness and mass terms in the equation. These methods involve breaking down the matrices into smaller, simpler equations that can be solved using numerical techniques such as the Runge-Kutta method or the Backward Differentiation Formula (BDF).

What are some applications of ODE solvers for second order ODEs with stiffness and mass matrices?

ODE solvers for second order ODEs with stiffness and mass matrices are commonly used in scientific and engineering fields to model and simulate physical systems. They are particularly useful in areas such as structural analysis, heat transfer, fluid dynamics, and electrical circuits. These solvers allow researchers and engineers to accurately predict the behavior of complex systems and make informed decisions based on the results.

Back
Top