I have been learning forward kinematics and having some trouble with coordinate systems and dh parameters with prismatic joints. Trying to work through this question. Trying to work this out I ended up with this system. However running through matlab it appears to be wrong. If anyone is able to point out my mistake, or help point me in the right direction, would be appreciated!
Frame 3 (transform from 2 to 3) does not match the parameters in column 2. DH parameters cannot describe the transform you sketched.
See if the frames below help. Remember that DH is a mathematical way to reduce the number of parameters for when you need to manipulate the equations by hand. Frames that fit the DH parameterization for a given kinematic topology don't necessarily match the frames that humans might choose.
Pro-tip. Don't use DH if you are doing numerical analysis. People (designers) tend to think of robot kinematic neutral positions along orthogonal directions. As such, writing the transform matrix directly, augmented with a parameterization along Z, is easy to do, and lets you put the link frames wherever you like without problem.