Transcript

General Computer General Computer Science Science

for Engineersfor EngineersCISC 106CISC 106

Lecture 01Lecture 01

James AtlasComputer and Information Sciences

9/2/2009

Course OverviewWebsite:

◦http://www.udel.edu/CIS/jatlas/106/09F/

Lab based course◦MATLAB◦TA for each lab

LabsPair programmingLabs assigned on MondayLabs always due on the following

Thursday at 11:55PM (10 days from assignment)

Projects are group work and will be due 3 weeks after assigned

GradingLabs (25%)Participation (5%)Two Projects (10% + 10%)Two Midterm Exams (15% + 15%)Final Exam (20%)

Your final course grade cannot be more than one letter grade higher than your exam average

Course HelpOffice Hours

◦Tues 1-3PM Thurs 2-4PM◦TA: TBD

Sakai◦Forums are great!

E-mail

Intro to Computer ScienceExercise:Compute based PictionaryYour team must create a list of

instructions to draw a picture◦ Choose a simple object to draw◦ Numbers are allowed◦ All prepositions, adjectives are allowed

on, next to, across

◦ Nouns can only be geometric nouns: Circle Line Square

◦ No “car” or object nouns

MATLABCommand lineInteractive (interpreted)matlab

◦GUI versionmatlab -nodesktop

◦Text version

MATLABPrompt

◦>>Expression

◦>> 2 * 2Variable

◦>> product = 2 * 2

MATLABHow can we calculate the area of

a circle?

>> pi * 3^2

>> radius = 3>> pi * radius ^ 2

fx f(x)

fradius area

FunctionsFunctionsTop-down program design (pp.

87-90)Breaking problems downCode reuse (Don’t reinvent the

wheel)

How do we write functions in MATLAB?

MATLAB m-filesMATLAB m-filesCreate a circleArea m-file

Sample function circleArea.mSample function circleArea.m

%circleArea = number -> number%takes the radius of a circle and

returns the calculated area of a circlefunction outputValue =

circleArea(radius) outputValue = pi * radius ^ 2;

Now, what if we want to Now, what if we want to calculate area of a ringcalculate area of a ringA ring of two concentric circles

= -

Area of a ringArea of a ringpi * (radius1)^2 – pi *

(radius2)^2

Test area of a ringTest area of a ringringArea(2,1)ringArea(3,1)Etc.


Top Related