MATLAB Programming/Examples of MATLAB Command

Introduction
MATLAB is interesting in that it is dynamically compiled. In other words, when you're using it, you won't run all your code through a compiler, generate an executable, and then run the executable file to obtain a result. Instead, MATLAB simply goes line by line and performs the calculations without the need for an executable.

Partly because of this, it is possible to do calculations one line at a time at the command line using the same syntax as would be used in a file. It's even possible to write loops and branches at the command line if you want to. Of course this would often lead to a lot of wasted efforts, so doing anything beyond very simple calculations, testing to see if a certain function, syntax, etc. works, or calling a function you put into an .m file should be done within an .m file.

Examples
MATLAB can perform the functions of a simple calculator from the command line. We go thru some of the common Maths problem in the real life.

Here are few of mathematics problem that are demonstrated to be solved in MATLAB:

Painting Coverages
A house painter usually uses 10L of white paint to cover 120 square meter on average for single layer of coating.

Calculate how many 10L paint cans that house painter needed to buy to paint a room with size of 13m X 9m with height 5m from floor to ceiling.

Also the room have 2 windows with size of 1.5m*0.75m and 2m*1.25m and a door with size of 1.2m*3m

Earth to Sun Distance
Distances from sun to earth is equivalent to 150 million km (150,000,000 km)

If human launched a advance rocket capable of achieving constant speed of 7km/s (ignore all of the air frictions, gravitational pull), how many year(s) does the rocket to reach the sun from earth ?

Dice Roll for board games
You invite some friends come over to play a board game but somehow the dice that should be comes with board game is missing. Create a MATLAB programs to throw two dices (with 6 faces)

You need to use randi command to generate random numbers. More command can be learnt here: MATLAB Programming/Fundamentals of MATLAB/MATLAB operator

External Resources
ControlTheoryPro.com