1 / 26

EECS 1541 Introduction to Computing for the Physical Sciences Winter 2015

EECS 1541 Introduction to Computing for the Physical Sciences Winter 2015. EECS 1541 -- Introduction to Computing for the Physical Sciences. Introduction – Course Overview. Instructor : John Lam Office : Lassonde Building 1012G E-mail : johnlam@cse.yorku.ca

Download Presentation

EECS 1541 Introduction to Computing for the Physical Sciences Winter 2015

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. EECS 1541 -- Introduction to Computing for the Physical Sciences Introduction – Course Overview Instructor:John Lam Office:Lassonde Building 1012G E-mail:johnlam@cse.yorku.ca Lecture: Tuesday & Thursday 2:30 – 3:30pm Office hours:Wednesday & Thursday 3:30pm – 4:30pm 2

  3. EECS 1541 -- Introduction to Computing for the Physical Sciences Introduction – Course Overview Course website:http://www.eecs.yorku.ca/course_archive/2014-15/W/1541/ • There are 8 labs in total (3% each) • Labs start next Tuesday (Jan 13) • 2 term tests (20% each) • Final exam (36%) Please setup your CSE account and have it ready by next Tuesday! 3

  4. EECS 1541 -- 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. EECS 1541 -- 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. EECS 1541 -- Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 1) 9

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

  11. EECS 1541 -- 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. EECS 1541 -- 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. EECS 1541 -- 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. EECS 1541 -- 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. EECS 1541 -- 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. EECS 1541 -- Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) 17

  18. EECS 1541 -- 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. EECS 1541 -- Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) A “for-loop” is used to implement the Series 19

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

  21. EECS 1541 -- 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. EECS 1541 -- 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. EECS 1541 -- Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 2) 23

  24. EECS 1541 -- 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. EECS 1541 -- Introduction to Computing for the Physical Sciences Introduction – MATLAB (Example 3) 25

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

More Related