Giter VIP home page Giter VIP logo

mpc-matlab's Introduction

MPC-MATLAB

Model Predictive Control using MATLAB.

The codes are based on my short lecture series on MPC titled MODEL PREDICTIVE CONTROL USING MATLAB. For a better understanding of the codes and the theory of MPC, the lectures can be refered. The link for accessing the lectures is given below:

https://www.youtube.com/playlist?list=PL0IUz_pjFlJ2LsSTLY4I1yBhgGJeo9Baf

The link for accessing the lecure note is given below:

https://www.researchgate.net/publication/357017341_MODEL_PREDICTIVE_CONTROL_USING_MATLAB

mpc-matlab's People

Contributors

midhunta30 avatar

Stargazers

 avatar  avatar Shuqi Xu avatar  avatar  avatar  avatar  avatar  avatar LL avatar LIU-JIAQUAN avatar  avatar RunqiQiu avatar Naeim Ebrahimi Toulkani avatar  avatar Roman avatar Justin Nguyenvu avatar  avatar Sudiro avatar  avatar Banuso avatar  avatar Neway Yifru avatar  avatar  avatar

Watchers

 avatar

mpc-matlab's Issues

Question regarding use of fmincon

Hello @MIDHUNTA30,

First of all, thank you for making this content available. I am beginning my introduction to NMPC and I have two questions regarding the use of fmincon as an optimization solver. First, the vector z is constructed by aggregating Xk and Uk (states and manipulated variables). When you call fmincon, how does it know that it should solve and find the values of only the inputs U for minimizing the cost function? As it is, won't it find the overall combination of X and U which minimizes the cost function?
Second, can you please explain how you defined the non-linear constraints in NMPC1 and NMPC2? And why you didn't do it in the LMPC examples?

Moreover, I am having working on a problem with eight states and two inputs, all with different lower and upper bounds, and I defined them like this:

lb=[x1minones(1,(N+1)),x2minones(1,(N+1)),x3minones(1,(N+1)),x4minones(1,(N+1)),x5minones(1,(N+1)),x6minones(1,(N+1)),x7minones(1,(N+1)),x8minones(1,(N+1)),u1minones(1,N),u2minones(1,N)];

ub=[x1maxones(1,(N+1)),x2maxones(1,(N+1)),x3maxones(1,(N+1)),x4maxones(1,(N+1)),x5maxones(1,(N+1)),x6maxones(1,(N+1)),x7maxones(1,(N+1)),x8maxones(1,(N+1)),u1maxones(1,N),u2maxones(1,N)];

Is this correct?

Thank you!

Question regarding xref and trajectory tracking

First of all, I would like to thank you for your amazing work that as helped me a lot in my MPC internship.
I have a question, especially on the NMPC_2.m code file, if we would like to make trajectory following by changing the reference value over time (example x1 = 0.5kTs, x2 = 1), How should we incorporate theses reference changes? I have tried to do so with a unicycle robot model adding some changes in the nlcon function to adjust the value of the reference with the Prediction horizon location in time but with no successful results. (i can send you my .py file if you want to check)
If you have any code example, it would help me a lot

Thank you Midhun

Confusion with Dimensions

Hello @MIDHUNTA30 ,

First of all, I am really thankful to you that you uploaded your lectures on YouTube. They were of great help to me. After going through your lectures I wanted to try implementing the code myself, but I think there is some inconsistency between the dimensions of the block-diagonal matrices that you have and that I came up with. If you refer to your code LMPC_1.m. The dimension of the variable FX comes out to be 24x12 but when I tried it on my own to verify the dimension, I get it to be 48x24. And this is how I am calculating the dimension of FX :

Since FX is a block diagonal consisting of Fx matrices which is of dimension 4x2 as its diagonal elements.

Now FX is to be pre-multiplied with Xk ( as per your notes ) which is of dimension 12x1, so the block diagonal matrix must be of size 12x12.

Since every element of the block diagonal matrix of size 4x2, therefore the dimension of the block diagonal should be 48x24.

I am not sure if I am calculating the dimensions in the correct manner , Can you please let me know where i am going wrong ?

Thank you.

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.