Presentation is loading. Please wait.

Presentation is loading. Please wait.

EECS 1541 Introduction to Computing for the Physical Sciences

Similar presentations


Presentation on theme: "EECS 1541 Introduction to Computing for the Physical Sciences"— Presentation transcript:

1 EECS 1541 Introduction to Computing for the Physical Sciences
Winter 2015

2 Introduction – Course Overview
EECS Introduction to Computing for the Physical Sciences Introduction – Course Overview Instructor: John Lam Office: Lassonde Building 1012G Lecture: Tuesday & Thursday 2:30 – 3:30pm Office hours: Wednesday & Thursday 3:30pm – 4:30pm 2

3 Introduction – Course Overview
EECS Introduction to Computing for the Physical Sciences Introduction – Course Overview There are 8 labs in total (3% each) Labs start next Tuesday (Jan 13) 2 term tests (20% each) Final exam (36%) Course website: Please setup your CSE account and have it ready by next Tuesday! 3

4 Introduction – Course Overview
EECS Introduction to Computing for the Physical Sciences Introduction – Course Overview How to do well in the course? Do all the labs (3% each!) Attend lectures Do not skip the tests Read the text and study lecture notes 4

5 EECS 1541 -- Introduction to Computing for the Physical Sciences
Introduction – MATLAB This is an introductory course on computing for physical sciences using MATLAB What is MATLAB (MATrix LABoratory)? Software program for technical computing, it combines computation, visualization and programming. 5

6 EECS 1541 -- Introduction to Computing for the Physical Sciences
Introduction – MATLAB Computation: computes value from complex equations; solving a single equation or a system of equations Visualization: plots different types of 2-D graphs, 3-D contours Progamming: creates conditional statements or small programs such as using “if-statement”, “while-loop”, “for-loop”, etc. 6

7 EECS 1541 -- Introduction to Computing for the Physical Sciences
Introduction – MATLAB Computation: computes value from complex equations; solving a single equation or a system of equations Visualization: plotting different types of 2-D graphs, 3-D contours Progamming: create conditional statements or small programs such as using if-loop, while-loop, for-loop 7

8 Introduction – MATLAB (Example 1)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 1) Recall that a linear equation with slope m and y-intercept b is given by: Suppose the y-intercept b is zero and the slop is 3/2, and we want to plot the equation for -3 ≤ x ≤ 3: 8

9 Introduction – MATLAB (Example 1)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 1) 9

10 Introduction – MATLAB (Example 1)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 1) 10

11 Introduction – MATLAB (Example 1)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 1) Suppose a parabola w is plotted on the same graph with the previous linear function and we want to determine the x-coordinates of the intersection points 11

12 Introduction – MATLAB (Example 1)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 1) Can we determine the exact x-coordinate? Approx. x = 2.4 x = 0 12

13 Introduction – MATLAB (Example 1)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 1) Alternatively, we can equate the two equations and solve for x from MATLAB to determine the exact points: 13

14 Introduction – MATLAB (Example 1)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 1) Solutions: x = 0 or 9/4 (i.e. 2.25) 14

15 EECS 1541 -- Introduction to Computing for the Physical Sciences
Introduction – MATLAB Computation: computes value from complex equations; solving a single equation or a system of equations Visualization: plotting different types of 2-D graphs, 3-D contours Progamming: create conditional statements or small programs such as using if-loop, while-loop, for-loop 15

16 Introduction – MATLAB (Example 2)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) A periodic symmetrical square wave can be represented by the Fourier Series representation: Let’s plot the above series that consists of the first 3 terms for 0 ≤ x ≤ 2π: 16

17 Introduction – MATLAB (Example 2)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) 17

18 Introduction – MATLAB (Example 2)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) We can see that the graph is not really a perfect square wave, this is because we only used 3 of the terms in the Series. We can increase the “resolution” of the square wave by including more terms in the Series. Instead of typing each term into MATLAB, we can use a “for-loop” to create the series to include “n” terms in the Series: 18

19 Introduction – MATLAB (Example 2)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) A “for-loop” is used to implement the Series 19

20 Introduction – MATLAB (Example 2)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) 20

21 Introduction – MATLAB (Example 2)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) We can put the 2 graphs on the same plot for comparison. 21

22 Introduction – MATLAB (Example 2)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) Essentially, the Fourier Series consists of terms with different frequencies. Fundamental component The first term is called fundamental component and the rest of the terms are called the harmonics. We are interested to see the amount of harmonics in this series. 22

23 Introduction – MATLAB (Example 2)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) 23

24 Introduction – MATLAB (Example 3)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 3) The previous example shows a type of built-in function in MATLAB (i.e. the sin function) You can create your own function in MATLAB and use it anytime. Suppose we want to create a function that is called “vol_cylinder.m”. This function will calculate the volume of a cylinder based on two input parameters: radius, height. 24

25 Introduction – MATLAB (Example 3)
EECS Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 3) 25

26 Introduction – Matlab (Example 3)
EECS Introduction to Computing for the Physical Sciences Introduction – Matlab (Example 3) 26


Download ppt "EECS 1541 Introduction to Computing for the Physical Sciences"

Similar presentations


Ads by Google