I have written the same code at least four times now

Roughly once a year I have to do some sort of kinematics simulation, and I go off in search of a DH parameters simulator, and I find half a dozen of them online, and none of them have been maintained in years, and I end up writing my own from scratch in MATLAB, and it's stored in ~/Documents/MATLAB and not in Dropbox, and it doesn't get backed up anywhere, and eventually I upgrade my OS, and then it's a year later and I have some new kinematics problem to simulate. So a few weeks ago, when the cycle started up again, I decided that I am ridiculous and I should break the cycle by documenting my simulation here.

Simply, I had to do some forward kinematics to make a cartesian controller for an end effector, and I ended up making a pretty standard DH parameters forward calculator for MATLAB. That code is available on Github. It's as transparent as I could make it. There are essentially two functions, one that converts a set of DH parameters into a DH matrix, and one that stacks DH matrices on top of a user-specified origin point to produce the corresponding forward kinematic point. In the example plotR2Arm.m, the only code that really matters is the list of DH parameters (lines 34-41) and the calculator (lines 51-53). Everything else is just there to make the pictures fancier.

Hopefully, someone finds this useful. Maybe that will be future me. Feel free to use the code, and email me if you have any questions. It doesn't require any fancy dependencies, so as long as MATLAB maintains the ability to multiply matrices, it should work out of the box.