SUNY Geneseo Department of Mathematics

Lab 8—The Matlab Debugger

Math 230 01
Fall 2015
Prof. Doug Baldwin

Complete by Monday, November 30
Grade by Your Next Grading Appointment

Purpose

This lesson gives you a basic ability to use Matlab’s debugger.

Background

A debugger is a programming tool that lets you interact with a program while it executes: monitor the values of variables, watch the program execute line by line, etc. Matlab has an easy-to-use debugger for functions and scripts. I will demonstrate some of this debugger’s features in class on November 30.

Activity

Some of you noticed that the bisection function you developed for lab 7 gives you an unexpected answer of 0 if you ask it to find the x coordinate for the closest point on the peninsula in the interval [-2,2]. This answer appears incorrect because visually the closest points ought to have x coordinates near -2 or 2. Such a situation—an unexpected and seemingly incorrect result from a program—is exactly what debuggers are meant to help programmers sort out.

Use Matlab’s debugger to explore the behavior of your bisection function when asked to find a root of the derivative of the lab 7 distance function in the interval [-2,2]. In particular, use the debugger to…

Follow-Up

I will grade this exercise in a face-to-face meeting with you. However, you do not have to schedule a separate meeting for this exercise—we can discuss it briefly during your next meeting with me for grading some other exercise.