General Computer Science for Engineers CISC 106 Lecture 05 James Atlas Computer and Information Sciences 6/22/2009.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Lab5 (Signal & System) Instructor: Anan Osothsilp Date: 20 Feb 07 Due Date 09 March 07.
1.3 ARRAYS, FILES, AND PLOTS + FOURIER SERIES BY MR. Q.
General Computer Science for Engineers CISC 106 Midterm 2 Review James Atlas Computer and Information Sciences 11/06/2009.
1 PHP Statement Constructs Server Scripting. 5-2 Basic Statement All Statements end in a semicolon. Statements are delimited from the HTML code by enclosing.
MATLAB’s extensive, device-independent plotting capabilities are one of its most powerful features. They make it very easy to plot any data at any time.
MA/CS375 Fall MA/CS 375 Fall 2002 Lecture 4.
General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
Lecture 5 Review Programming Program Structures Comparison Repetition: looping or iteration Conditional execution: branching Bubble Sort.
IAT 800 Foundations of Computational Art and Design Lecture 2.
General Computer Science for Engineers CISC 106 Lecture 19 Dr. John Cavazos Computer and Information Sciences 04/06/2009.
General Computer Science for Engineers CISC 106 James Atlas Computer and Information Sciences 10/23/2009.
General Computer Science for Engineers CISC 106 Lecture 07 Dr. John Cavazos Computer and Information Sciences 2/25/2009.
EGR106 Week 6 MATLAB FILES Two Dimensional Plots Multiple Plots
General Computer Science for Engineers CISC 106 Lecture 10 Roger Craig Computer and Information Sciences 3/06/2009.
General Computer Science for Engineers CISC 106 Lecture 08
Vectors and Plotting Selim Aksoy Bilkent University Department of Computer Engineering
General Computer Science for Engineers CISC 106 Lecture 25 Dr. John Cavazos Computer and Information Sciences 04/20/2009.
General Computer Science for Engineers CISC 106 Lecture 13 Roger Craig Computer and Information Sciences 3/13/2009.
General Computer Science for Engineers CISC 106 Lecture 07 James Atlas Computer and Information Sciences 9/18/2009.
1 Introduction to MatLab MatLab stands for Matrix Laboratory. As the name suggests most of the programming operations have as input or output a matrix.
General Computer Science for Engineers CISC 106 Lecture 09 James Atlas Computer and Information Sciences 9/25/2009.
General Computer Science for Engineers CISC 106 Lecture 05 Dr. John Cavazos Computer and Information Sciences 2/20/2009.
General Computer Science for Engineers CISC 106 Lecture 08 James Atlas Computer and Information Sciences 9/21/2009.
CS212: DATASTRUCTURES Lecture 3: Recursion 1. Lecture Contents 2  The Concept of Recursion  Why recursion?  Factorial – A case study  Content of a.
For loop Khairul anwar.
Introduction to MATLAB adapted from Dr. Rolf Lakaemper.
General Computer Science for Engineers CISC 106 Lecture 07 James Atlas Computer and Information Sciences 06/29/2009.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
CS212: DATASTRUCTURES Lecture 3: Recursion 1. Lecture Contents 2  The Concept of Recursion  Why recursion?  Factorial – A case study  Content of a.
COMP 116: Introduction to Scientific Programming Lecture 5: Plotting, Scripts and publishing.
16 Graph Skills How to read and understand advanced types of bar charts, area graphs, climographs and triangle graphs How to advance their skills of drawing.
By Chad Blankenbeker.  The for-loop is best used when you know how many times it is going to be looped  So if you know you want it to only loop 10 times,
MAT 4725 Numerical Analysis Section 1.4 Loops with “do” statements
Introduction to MATLAB adapted from Dr. Rolf Lakaemper.
111/18/2015CS150 Introduction to Computer Science 1 Announcements  I have not graded your exam yet.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
UW CSE 190p Section 7/26, Summer 2012 Dun-Yu Hsiao.
How to Read, Develop, and Interpret GRAPHS! OBSERVATIONS: often are recorded in a data table. We INTERPRET our data table by making INFERENCES and PREDICTIONS.
Sept. 26, 2005 Lecture 6 - By Paul Lin 1 CPET 190 Lecture 6 Problem Solving with MATLAB
LCC 6310 Computation as an Expressive Medium Lecture 2.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
General Computer Science for Engineers CISC 106 Lecture 2^4 Roger Craig Computer and Information Sciences 03/23/2009.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
General Computer Science for Engineers CISC 106 Lecture 13 - Midterm Review James Atlas Computer and Information Sciences 10/02/2009.
General Computer Science for Engineers CISC 106 Lecture 15 Dr. John Cavazos Computer and Information Sciences 03/16/2009.
Lecture 15: Course Review BJ Furman ME 30 16MAY2011.
General Computer Science for Engineers CISC 106 Lecture 06 James Atlas Computer and Information Sciences 06/24/2009.
General Computer Science for Engineers CISC 106 Lecture 14 James Atlas Computer and Information Sciences 08/10/2009.
Why Repetition? Read 8 real numbers and compute their average REAL X1, X2, X3, X4, X5, X6, X7, X8 REAL SUM, AVG READ *, X1, X2, X3, X4, X5, X6, X7, X8.
CS100A, Fall 1998, Lecture 191 CS100A, Fall 1998 Lecture 19, Thursday Nov 05 Matlab Concepts: Matlab arrays Matlab subscripting Matlab plotting.
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
General Computer Science for Engineers CISC 106 Lecture 03 James Atlas Computer and Information Sciences 6/15/2009.
Outline What is MATLAB MATLAB desktop Variables, Vectors and Matrices Matrix operations Array operations Built-in functions: Scalar, Vector, Matrix Data.
ITEC 2600 Introduction to Analytical Programming
Computer Application in Engineering Design
ECE 1304 Introduction to Electrical and Computer Engineering
EGR 115 Introduction to Computing for Engineers
Topics discussed in this section:
Chapter 6 Repetition Objectives ❏ To understand basic loop concepts:
Structured Program Development in C
Topics discussed in this section:
Plotting Multiple Graphs In The Same Plot
Introduction to Matlab LAB 4
switch Selection Structure
IAT 800 Foundations of Computational Art and Design
LCC 6310 Computation as an Expressive Medium
REPETITION Why Repetition?
Presentation transcript:

General Computer Science for Engineers CISC 106 Lecture 05 James Atlas Computer and Information Sciences 6/22/2009

Lecture Overview Review Plotting Simple Plots Arrays Recursion

Review For loop If statement

Branching Constructs We already covered the IF statement Why would IF be considered a “branch”?

Branching Constructs Why would IF be considered a “branch”? ◦ Let’s look at what happens to our code when it is executing on the CPU

Switch construct switch (switch_expression) case case_expr_1 statement 1 statement 2 case case_expr_2 statement 1 statement 2 otherwise statement 1 statement 2 end

Switch construct color = ‘yellow’; switch (color) case ‘red’ disp(‘Stop now!’); case ‘green’ disp(‘Proceed through intersection.’); case ‘yellow’ disp(‘Prepare to stop.’); otherwise disp(‘Illegal color encountered.’); end

For loop for sum integers total = 0; for i = 1:1:100 loop starts at 1 total = total+i; loop increments by 1 end

While loop while expression statement end

While loop for sum integers total = 0; i = 1; while i <= 100 loop starts at 1 total = total+i; loop increments by 1 i = i + 1; end

Recursion

Plot Using the plot command plot(, ) where array1 is the x-axis and array2 is the y-axis NOTE: array1 and array2 must be equal in terms of size of dimensions!

Plot For example: x=[ ]; y=[ ]; plot(x,y)

Plot Other useful command with plot xlabel(‘ ’) – sets the label for the x-axis ylabel(‘ ’) – sets the label for the y-axis grid on – creates a grid title(‘ ’) – sets title of the plot

Plot For example: x=0:1:10; y=x.^ *x + 15; plot(x,y)

Plot commands title(‘Graph Title’); xlabel(‘X axis label’); ylabel(‘Y axis label’); grid on; legend(‘series 1’, ‘series 2’,..., ‘BR’); print -dpng mygraph.png