Git Product home page Git Product logo

inverted-pendulum's Introduction

inverted-pendulum

Repository for my for my 4th Year Engineering Project, 'Control of an inverted pendulum using machine learning'.

This code is was written/created using MATLAB and Simulink.

'main_training.m' is used to generate a training data set, by simulating many different initial conditions of an inverted pendulum controlled by a de-tuned PID controller. This system is contained as a Simulink model in 'pid_ss.slx'.

'state_space.m' is a function which returns the state_space representation of an inverted pendulum system based on the input parameters.

'scaling.m' can be used to scale the data to between -1 and 1, while saving the scaling factors.

Once this data has been generated, the MATLAB Regression Learner and Neural Network Fittting tools can be used to train and export machine learning models.

'ml_ss.slx' is the Simulink model for machine learning regression models. Once a model has been trained, 'model_for_simulink.m' can be used to convert it to a Simulink-able format. Changing the name of the model in the MATLAB function block of 'ml_ss.slx' and making sure the scaling factors are in the workspace will allow the model to control the pendulum.

'nn_ss.slx' is the Simulink model for the neural networks. When using the Neural Network Fitting tool, the network can be exported as a Simulink block. Simply placing this in position in the subsystem and loading scaling factors should allow a nerual network to control the pendulum.

'anim.m' generates the an output gif file of the system. All it needs in the workspace is a Simulink output object called 'out' with fields 'x', 'phi', 'x_dot' and 'phi_dot'. This will be generated when running any of the Simulink models.

'performance.m' is used to simulate the pendulum through different parameters in order to evaluate performance

'rmse.m' calculates the RMSE and success rate of the simulations generated by 'performance.m'

'plotter.m' is simply used to generate output plots

inverted-pendulum's People

Contributors

andrwcnln avatar

Watchers

 avatar

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.