Did it in matlab