finished p3 matlab