This MATLAB code simulates the free vibration of a two-story building modeled with coupled second-order differential equations. It uses Euler’s Method (EM), Improved Euler’s Method (IEM), and an analytical solution to compute and compare the displacements of the building’s floors over time.
The behavior of the two-story building is governed by the following coupled second-order differential equations:
m1 x1'' = -k1 x1 - k2 (x1 - x2)
m2 x2'' = -k2 (x2 - x1)
The physical parameters of the system are:
- Spring stiffness: ( k1 = k2 = 4.66 \ kN/mm)
- Mass of the first floor: ( m1 = 0.0917 )
- Mass of the second floor: ( m2 = 0.0765 )
- x1(0) = 100 , x2(0) = 50
- x1'(0) = 0, x2'(0) = 0
Simulate the behavior of the system over the interval ( t in [0, 10] ) using the following approaches:
- Analytical solution for the given parameters.
- Numerical solutions using:
- Euler's Method (EM)
- Improved Euler's Method (IEM)
- Numerical Methods:
- Euler's Method (EM)
- Improved Euler's Method (IEM)
- Comparison with Analytical Solution.
- Plots:
- Solutions from EM, IEM, and analytical methods.
- Different numbers of time steps (( N = 45, 55, 75, 100, 250 )).
The repository includes:
EMsolver
: Solves the system using Euler's Method.IEMsolver
: Solves the system using Improved Euler's Method.analytical
: Computes the analytical solution.
-
Clone the repository:
git clone https://github.com/yourusername/two-story-vibration.git
-
Open the MATLAB script in the repository.
-
Execute the script to:
• Compute the solutions using EM, IEM, and analytical approaches.
• Plot the results for different time step values.