Introduction to MATLAB

Please feel free to raise any comments or issues on the website’s Github repository. Pull requests are very much appreciated.


A quick tutorial on MATLAB and the most important features that one uses in Macroeconomics or for Dynare.


  • Default layout of MATLAB
  • Interacting with the command window
  • Interacting with the workspace window
  • Command history
  • Preferences
  • Creating scripts
  • Basic computations
  • Calling built-in functions
  • MATLAB is a matrix language, i.e. check your dimensions!
  • Element-wise computations
  • Comments
  • Matrix left divide to solve systems of linear equations
  • Looking at the help of a function
  • Functions can have both several inputs as well as several outputs
  • Difference between mldivide and inv
  • MATLAB is case sensitive
  • Different types of variables
  • Additional toolboxes
  • Toolboxes commonly used in Macroeconomics and Econometrics
  • How to look for and get help
  • Initialize arrays of any dimension
  • Change values in arrays
  • Empty vector can delete stuff in arrays
  • Writing user functions
  • Very basic plot
  • if statements
  • Difference between error and warning
  • for loop
  • Terminate busy computations


  • Brandimarte (2006, Appendix A) - Numerical Methods in Finance & Economics A MATLAB based Introduction - Paolo Brandimarte
  • Miranda, Fackler (2002, Appendix B) - Applied Computational Economics and Finance