Physics 143 Assignment 1: Ray Tracing
This lab activity is designed to help you understand the principles of ray tracing and the thin
lens equation by manipulating and analyzing a provided MATLAB script. Explore how
changing key variables affects the position, size, and nature of the image formed by a
converging lens.
Part 1: Initial Exploration (15 minutes)
1. Run the Script: Start by running the provided MATLAB script with its default
parameters (f=5 cm, do=12 cm).
2. Analyze the Output: Carefully observe the generated plot.
o Identify the object (red line) and the image (cyan line). Is the image real or
virtual? Is it inverted or upright?
o Trace each of the three principal rays (blue, green, and magenta). Confirm
that their paths align with the rules for a converging lens:
▪ Ray 1: Parallel to the axis, then passes through the focal point.
▪ Ray 2: Through the center of the lens, undeflected.
▪ Ray 3: Through the focal point, then emerges parallel to the axis.
o Compare the calculated image distance (di) and image height (hi) from the
script with the graphical output. Do they match?
Part 2: Interactive Investigation (30 minutes)
Now, you will modify the script to observe the effects of changing the object's position
relative to the focal length. For each scenario below, record your observations and take a
screenshot of the resulting plot.
1. Case 1: Object Far from the Lens (do>2f)
o Set do to a value greater than 2f (e.g., do=15 cm, with f=5 cm).
o Question: Where does the image form relative to the focal point? What are
its characteristics (real/virtual, inverted/upright, magnified/diminished)?
2. Case 2: Object at Twice the Focal Length (do=2f)
o Set do to be exactly 2f.
o Question: Where does the image form? How does the image size compare to
the object size?
3. Case 3: Object Between f and 2f (f<do<2f)
o Set do to a value between f and 2f.
o Question: How does the image position and size change compared to the
previous cases?
4. Case 4: Object Inside the Focal Point (do<f)
o Set do to a value less than f.
o Question: What happens to the three principal rays? Does a real image
form? How will you modify the code to trace the diverging rays back to form a
virtual image? (Hint: You may need to add code to extend the rays backward
using dashed lines.)
Part 3: Report and Analysis
Prepare a lab report summarizing your findings. The report should include:
• A brief introduction to the principles of ray tracing and the thin lens equation.
• The MATLAB code you used for each of the four cases, along with the corresponding
plots.
• For each case, answer the questions posed in Part 2.
• A discussion of the relationship between the object distance (do), focal length (f),
and the characteristics of the image (position, size, and nature). Explain how your
observations from the simulation support the thin lens equation (1/f=1/do+1/di) and
the magnification equation (M=ho/hi=−do/di).