ML: conversion of exercise 2 to Matlab
ML: conversion of exercise 3 to Matlab