Have a look at : https://www.mathworks.com/matlabcentral/fileexchange/21810-one-dimensional-photonic-crystal-dispersion-relations?focused=5104560&tab=function
It's not that much difficult. Creat the transfer matrix for each layer (Three as per your requirement). Multiply three matrices to built the unit cell matrix. Next, determine the final matrix by taking number of the unit cells. At last, you can extract the optical components from the final matrix, for example, reflectance.
Try this, If you find any problem then contact me.