### Abstract:

Crystal structure especially lattice parameters in hexagonal system is difficult to be determined in conventional way. Therefore, it is necessarily to involve a computer to perform the calculation of parameters of hexagonal crystal lattice. In this study, two computer programs have been written using a software which is called MATLAB version R2007b. The first program called Program Menu is used to input the parameters required in performing the lattice parameters of crystal calculation. The second program called Main Program is used to determine the lattice parameters (a and c). The X-ray diffraction data was obtained from reference that is included Cobalt, Magnesium, Titanium and Zinc. The
most important data from X-Ray diffraction pattern is angle of X-Ray reflected beam (2θ). The Main program will calculate the distance between the planes of unit cell of the crystal (dhkl). Next, the code will continue the calculation to evaluate the value of lattice parameters (a and c) for all possible planes in the unit cell of the crystal. Finally, the code will choose the same value of lattice parameters (a and c) for different crystal planes (hkl). The result of the lattice parameter’s average for Cobalt are = 2.5138 Å and = 4.0799
Å , Magnesium has lattice parameters value of = 3.222 Å and = 5.2326 Å, Titanium has lattice parameters value = 2.9595 Å and = 4.6962 Å, and Zinc has lattice parameters value = 2.6737 Å and = 4.9638 Å. In this result, the values of lattice parameters are comparable with the values of lattice parameters in literature and this result
can be acceptable.