Giter Club home page Giter Club logo

simple-harmonic-oscillator-pendulum's Introduction

Simple-Harmonic-Oscillator-Pendulum

Numerical Simulation of a Simple Harmonic Oscillator Pendulum using three different numerical methods for comparison.

This MATLAB script simulates a simple, undamped harmonic oscillator pendulum using three different numerical methods: Euler, Euler-Cromer, and Runge-Kutta method. It compares methods to each other and the analytical solution by calculating:

  • Position Θ (Radian)
  • Velocity Ω (Radian/s)
  • Energy J (Joules)
  • Error percentage % difference from the analytical solution
  • The script also includes a phase plot for the all methods and the analytical solution

HarmonicOscillator.m is the main script where you run the simulation. Each numerical method function is seperated in a different .m file.

The simulation produces 5 figures:

  1. Comparing Angle vs Time of the three methods to the analytical solution.
  2. Comparing the Angular Velocity Vs Time calculation of the three methods.
  3. Comparing the Energy Vs Time calculation of the three methods.
  4. Comparing the error percentage (from the analytical solution) vs Time of the three methods.
  5. Phase plot comparing the three methods.

Reference Used: Computational Physics 2nd Edition - Nicholas J. Giordano and Hisao Nakanishi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.