#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 20 14:40:48 2025 @author: christian """ import numpy as np import pandas as pd import matplotlib.pyplot as plt # Parameters A = 1.0 # initial amplitude b = 0.2 # damping coefficient f = 1.0 # frequency (Hz) time = np.linspace(0, 5, 1000) # time vector # Dampened sine wave formula displacement = A * np.exp(-b * time) * np.sin(2 * np.pi * f * time) velocity = np.gradient(displacement, time) acceleration = np.gradient(velocity,time) # Plotting plt.figure(figsize=(8, 5)) plt.plot(time, displacement, label='disp. (m)', color='blue') plt.plot(time, velocity, label='vel. (m/s)', color='red') plt.plot(time, acceleration, label='acc. (m/s^2)', color='black') plt.title('Pendulum') plt.xlabel('Time (s)') plt.ylabel('f(t)') plt.grid(True) plt.legend() plt.tight_layout() plt.show()