SUNY Geneseo Department of Mathematics

Lesson 0—Getting Acquainted with Matlab

Math 230 01
Fall 2014
Prof. Doug Baldwin

Complete by Friday, August 29

Purpose

This lesson ensures that you have Matlab installed on your computer and that you can interact with it in basic ways: give it simple commands, understand its windows and menus, etc. You will need to be comfortable with these things in order to write and run programs throughout the rest of this course.

Background

This lesson has two parts: the first deals with getting Matlab installed on your computer, and the second with familiarizing yourself with its user interface.

Installing Matlab

The first part of this exercise asks you to install Matlab on your computer. This isn’t an intellectually difficult task, but it requires a certain amount of background knowledge.

Matlab is a commercial software package, meaning that it ordinarily costs money to use. Fortunately, Geneseo has a college-wide license that covers students, so you can install and use Matlab for free, at least while you are at Geneseo.

You can download a Geneseo-licensed copy of Matlab for either Windows or Mac OS at software.geneseo.edu, Geneseo’s software distribution site. Simply point a web browser at this site, scroll down to the “Matlab” entry, and click on the link for whichever kind of computer you have.

Once you have downloaded Matlab, follow the instructions for completing your Matlab installation at https://wiki.geneseo.edu/display/cit/MatLab+R2014a+Installation+Guide

Because it is licensed specifically to Geneseo, Geneseo’s Matlab only runs on computers that are connected to Geneseo’s campus network. This can be a problem if you like to work off campus. Fortunately, you can use Matlab off campus if you use a piece of software called a “virtual private network,” or VPN, which allows a computer anywhere in the world to look as if it is physically attached to a specific local network. Windows users who want to connect to Geneseo through a VPN need to first install appropriate VPN software—it’s the “Cisco VPN” package at software.geneseo.edu. Reasonably recent Macintosh computers come with VPN software pre-installed. You can find instructions for activating it at https://wiki.geneseo.edu/display/cit/Setting+up+Geneseo+VPN+on+Mac+OS+X+10.6+Snow+Leopard+to+10.9+Mavericks

The User Interface

Sections 1.1 and 1.2 of our textbook give a brief overview of how Matlab interacts with users. For a more visual and somewhat more detailed presentation, the video on The Matlab Desktop from the University of Edinburgh is helpful.

Activity

I plan to do each part of this lesson on a separate day: installing Matlab on Wednesday, August 27, and exploring the user interface on Friday, August 29.

Installing Matlab

Wednesday the 27th will be a day for sorting out any problems you run into installing Matlab. Try to do the installation (directions are in the “Background” section above) before class on Wednesday. If you run into problems that you aren’t able to fix, bring your computer to class Wednesday, and Nick or I will try to sort out the trouble. If you’re lucky and the installation goes smoothly and you are able to launch Matlab on your computer, you don’t need to come to Wednesday’s class at all.

The User Interface

On Friday the 29th we will work on the following problems/questions. I will give you a few minutes to work on each, followed by a few minutes of class discussion of what you found out and opportunity to try ideas suggested by classmates, then we will go on to the next problem, and so forth.

Problem 1

What trigonometric operations does Matlab provide?

Problem 2

What does Matlab’s diary command do? Why might you want to use it (other than because I tell you to)?

Record the rest of today’s Matlab session in a diary file.

Problem 3

Use Matlab to calculate the sum of 107 plus 28. As a “bonus” (OK, this exercise isn’t graded, so you don’t get the bonus in any tangible form, but in future exercises you probably will have opportunities for true extra credit bonuses), try to evaluate expressions involving some of the trigonometric functions you discovered in Problem 1.

Problem 4

Use Matlab to compute 10 - 4 - 2. What does this expression mean in English? Could it have plausibly meant something else (i.e., is there a different value it could plausibly have produced)? Can you guess how to make Matlab compute that other value?

Problem 5

Type the command

x = 1

into Matlab’s command window. What else, beside the contents of the command window, changes in Matlab’s workspace?

Follow-Up

The main value of this lesson is the experience it gives you using Matlab, so I won’t grade it—simply having done it gets you off a good start in this course.

The last 2 or 3 problems above set the stage for the first real programming concepts we will talk about, namely variables and expressions. We will start with variables on September 3.