Although I'm not going to help directly with your assignment (you'll learn more if I don't!) you still need to be more specific. For instance, "DOF" can be rotational, translational (aka "prismatic"), helical, and a whole bunch of other things (which are almost always reduced to rotational/prismatic, but...)
So what are the DOFs? Are you doing forward kinematics (from joint variables to (x,y,z)) or inverse kinematics (from (x,y,z) to joint variables)? What else do you know about the robot?
I also assume you're trying to make matlab code that takes in some parameters (either joint variables or (x,y,z)) and spits out the other paramters, right?
I can offer a few hints if you give more information. My best advice to you, though, would be to start with a simpler case, say a 2-link planar robot arm with two rotational DOF, and try to do the kinematics for it. Then just generalize what you learned to your 3DOF robot.
MIKE