Symbolic solution for system of equations

3 views (last 30 days)
Pavel
Pavel on 18 Jan 2016
Answered: Ayush Aniket on 28 Aug 2024
Hello. I'm trying to solve symbolically a equation of type M*Z_DDot+C*Z_Dot+K*Z=F, where M, C, K and F are 3x3 matrices. I want to solve for Z, which is a 3x1 vector containing the displacement of 3 masses. I've written a matlab script but it seems i cannot get around a problem regarding the boundary conditions. I'm using dsolve command and so far i was able to define only the initial displacement of the masses. Please tell me how do I define the velocity and acceleration boundary conditions using dsolve command. I can post the matlab script if necessary. Thank you very much.

Answers (1)

Ayush Aniket
Ayush Aniket on 28 Aug 2024
Hi Pavel,
You can specify the initial condition for velocity(Z_Dot) and acceleration (Z_DDot) in the following way:
1. While defining the equation, these derivatives will be incorporoated using the diff keyword in the equation as follows:
eqn = M*diff(Z,t,2) + C*diff(Z,t,1) + K * Z == F;
2. Then you can assign some variable names to the derivatives:
Z_Dot = diff(Z,t,1);
Z_DDot = diff(Z,t,2);
3. Finally, you can provide the initial values and plug the eqn and the initial condition cond into the dsolve command to solve your equation:
cond = [Z(0)==Z0, Z_Dot(0)==Z_Dot0, Z_DDot(0)==Z_DDot0];
ZSol(t) = dsolve(eqn,cond);
Refer to the following documentation which shows an example for the same:

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!