MATLAB Codes

Tutorial

To get a primer in MATLAB programming, download this tutorial-file and the data-file (right click and save target as; make sure you save it as .m-file). Put the two files into a directory of your choice on your hard disk. Make sure that the current directory of matlab is set on the chosen directory for your files and then type 'matlab_tutorial'.


Functions
  • Function that prints a given text many times on the screen Repeat.m
  • Function that calculates the mean and the standard deviation of a matrix: MeanStandardDeviation.m
  • Function that calculates the the root mean squared error between two vectors: rmse.m

Click here to download all functions at once.


Games
  • This code simulates a round of RussianRoulette
  • This code simulates a type of lottery drawing random numbers: GambleGame
  • This code simulates another type of lottery: Game2
Click here to download all games at once.


All Files

Click here to download all files at once.