General Computer Science for Engineers CISC 106 Lecture 01 James Atlas Computer and Information Sciences 9/2/2009
Course Overview Website: ◦ Lab based course ◦ MATLAB ◦ TA for each lab
Labs Pair programming Labs assigned on Monday Labs 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
Grading Labs (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 Help Office Hours ◦ Tues 1-3PM Thurs 2-4PM ◦ TA: TBD Sakai ◦ Forums are great!
Intro to Computer Science Exercise:Compute based Pictionary Your 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
MATLAB Command line Interactive (interpreted) matlab ◦ GUI version matlab -nodesktop ◦ Text version
MATLAB Prompt ◦ >> Expression ◦ >> 2 * 2 Variable ◦ >> product = 2 * 2
MATLAB How can we calculate the area of a circle? >> pi * 3^2 >> radius = 3 >> pi * radius ^ 2
f xf(x)
f radius area
Functions Top-down program design (pp ) Breaking problems down Code reuse (Don’t reinvent the wheel) How do we write functions in MATLAB?
MATLAB m-files Create a circleArea m-file
Sample function circleArea.m %circleArea = number -> number %takes the radius of a circle and returns the calculated area of a circle function outputValue = circleArea(radius) outputValue = pi * radius ^ 2;
Now, what if we want to calculate area of a ring A ring of two concentric circles = -
Area of a ring pi * (radius1)^2 – pi * (radius2)^2
Test area of a ring ringArea(2,1) ringArea(3,1) Etc.