solve the attached pdf

I need two things:

1) solution on paper with steps.

2) .m files containing the MATLAB code developed.