Download presentation
Presentation is loading. Please wait.
Published byElijah Willis Modified over 9 years ago
1
General Computer Science for Engineers CISC 106 Lecture 01 James Atlas Computer and Information Sciences 6/8/2009
2
Course Overview Website: ◦ http://www.cis.udel.edu/~atlas/106/09Su/ TA ◦ Zelphia Johnson Lab based course ◦ MATLAB
3
Labs Labs on Monday 7:00-8:30 ◦ Pearson 101D Assignments are solo work only! Labs due a week (Sunday) after assigned Projects are group work and will be due 3 weeks after assigned
4
Grading Labs (30%) Participation + Quizzes (5% + 5%) Two Projects (10% + 10%) Two Midterm Exams (10% + 10%) Final Exam (20%) Your final course grade cannot be more than one letter grade higher than your exam average
5
Course Help Office Hours ◦ 3:30-4:45 MW ◦ TA: TBD Sakai ◦ Forums are great! E-mail
6
Class Structure Mondays ◦ Review+Quiz ◦ Lesson ◦ Lab Review/Preview Wednesdays ◦ Lesson1 ◦ 5 minute break ◦ Lesson2
7
First Quiz!
8
Intro to Computer Science We learn to compute at a young age ◦ Math ◦ Word problems It takes this car 35 seconds to accelerate from zero to 100 miles per hour; determine how far the car gets in 20 seconds.
9
Intro to Computer Science We learn to compute at a young age ◦ Math ◦ Word problems It takes this car 35 seconds to accelerate from zero to 100 miles per hour; determine how far the car gets in 20 seconds. Data ◦ Information, not interpretation Operations (instructions)
10
Intro to Computer Science Exercise: ◦ Compute based Pictionary ◦ Your team must create a list of instructions and data to draw a picture Data can be any form of number+interpretation All prepositions, adjectives are allowed on, next to, across Nouns can only be geometric nouns: Circle Line Square No “car” or object nouns
11
MATLAB Command line Interactive (interpreted) matlab ◦ GUI version matlab -nodesktop ◦ Text version
12
MATLAB Prompt ◦ >> Expression ◦ >> 2 * 2 Variable ◦ >> product = 2 * 2
13
MATLAB How can we calculate the area of a circle?
14
MATLAB Ok, so now I have to calculate the area of 7000 circles >> area = pi * 0.7 * 0.7 >> area = pi * 9 * 9 >> area = pi * radius^2 Etc. What is inefficient about this approach?
15
Functions Top-down program design (pp. 87-90) Breaking problems down Code reuse (Don’t reinvent the wheel) How do we write functions in MATLAB?
16
Sample function circleArea function outputValue = circleArea(radius) outputValue = pi * radius ^ 2;
17
MATLAB m-files overview MATLAB script files are also known as m- files They end in.m file extension You can use the m file by typing the name of the m-file (without the.m extension)
18
MATLAB m-files Create a circleArea m-file How to save a file
19
Sample M-file circleArea.m to enter %circleArea.m %James Atlas, 6/8/2009 %Description: calculates the area of a circle given the radius function outputValue = circleArea(radius) outputValue = pi * radius ^ 2;
20
Now, what if we want to calculate area of a ring A ring of two concentric circles = -
21
Area of a ring pi * (radius1)^2 – pi * (radius2)^2
22
Test area of a ring ringArea(2,1) ringArea(3,1) Etc.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.