You may implement a PID controller using 2 of Ziegler Nichols methods:
1) using L, T of tangent at step
2) K_critical and P_critical
They both have a table for estimating the parameters Kp, Ki, Kd for P, PI, and PID that's 3x3 matrix to be specific.
Ziegler Nichols methods work for a single loop system with feedback where the transfer function seems to take the below form:
[ Kp (1 + 1/Ki*S + Kd*S) ]
This, being applied we try to stabilize a plant/system. And, if my assumption is correct you wish to write a MATLAB code to estimate these parameters of 3x3 matrices to do so. Then, the plant maybe actuators or anything else, it shall work.
About me:
I've an IEEE paper on the same topic. I mostly do such assignment and small projects. Tools: MATLAB /Octave, Python
Kindly let me know if my understanding is mistaken somewhere. Additionally, message me if you're interested in the project.
Thank you! Have a great weekend!