CIS 101: Computer Programming and Problem Solving Usman Roshan Department of Computer Science NJIT.

20
CIS 101: Computer Programming and Problem Solving Usman Roshan Department of Computer Science NJIT
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    224
  • download

    0

Transcript of CIS 101: Computer Programming and Problem Solving Usman Roshan Department of Computer Science NJIT.

CIS 101: Computer Programming and Problem Solving

Usman Roshan

Department of Computer Science

NJIT

Syllabus

• Office hours:• Course website:

– http://www.cs.njit.edu/usman/courses/cis101_spring06– Course powerpoint presentations and announcements will be

posted on website

• Course description: Learn MATLAB and use it to solve engineering and scientific problems

• Exams: Short in-class quizzes and one final• Homeworks: Problems assigned every week• Cheating policy: No cheating will be tolerated• Makeup exams: Only health related documented

excuses will be accepted

About this course

• Mainly focused around MATLAB

• We will take engineering and scientific problems and solve them using MATLAB

• Our focus is not to derive formulas but to learn how to program and solve problems using programming

• We may learn some C++ if time permits but MATLAB itself offers a lot to explore

Starting Matlab

MATLAB startup window

Description of windows

Help Window

Help Window: Very Useful!

Working in Command Window

Using MATLAB as a calculator

Using MATLAB as a calculator II

Displaying formats

Basic Math Functions

Elementary functions Trigonometric functions

Basic Math Functions II

Rounding functions

Example: using sqrt function

Defining variables in MATLAB

Variable_name = A numerical value, or a computable expression

Example 1 Example 2

Defining variables in MATLAB II

Example 3

Example 2

Example 4

Example 1

Defining variables in MATLAB II

Example 1 Example 2

Problem Solving I

costan sin

tan2

2 2

x x x

x

Verify that the indentity shown is correct by calculatingeach side of the equation using x

5

Problem Solving II

R1=16mm, R2=6.5mm,R3=12mm, R4=9.5mm

Find distance between C2 and C4

Problem Solving II

( ) ( ) ( ) ( )( ) co sC C C C C C C C C C2 32

1 22

1 32

1 2 1 3 12

Problem Solving III

T T T T eS Skt ( )0

To=Initial temperature of object at time t=0Ts=temperature of chamber object is placed intoT=temperature of object at time tk=constant

Temperature of object rises according to function shown below

If a soda can (from inside a hot car) at 120F is placed into a refrigerator with 38F hat is the temperature after 3 hours (k=0.45)?

Problem Solving III

Now we go to the lab!!