1 Quiz Preparation l Quiz 4 sheet provided. l Fill in your Name, etc. l Date is 9/11/12 l Answer questions during lecture. Lab Day/TimeSection Number Mon.

Slides:



Advertisements
Similar presentations
Introduction to MATLAB The language of Technical Computing.
Advertisements

What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially.
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Programming
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
Lecture 6 MATLAB functions Basics of Built-in Functions, Help Feature, Elementary Functions (e.g., Polynomials, Trigonometric Functions), Data Analysis,
CS 206 Introduction to Computer Science II 03 / 06 / 2009 Instructor: Michael Eckmann.
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
1. 2 Announcements l Reading assignments on the syllabus must be done BEFORE the lecture »Read Ch. 6 before next lecture »Read Ch. 4-5 before lab this.
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.
1 Announcements l Bring motors to lab this week. l Bring eight 1N4001 diodes to lab per team. Get them at the Scientific Supply Store (2 nd Floor Sciences.
CS 206 Introduction to Computer Science II 10 / 28 / 2009 Instructor: Michael Eckmann.
1 Announcements l Take textbook to lab. »Be sure to read Chapter 13 before lab –MATLAB tutorial –Can skip Section 13.4 l Bring your transmitter and receiver.
What is MATLAB ? MATrix LABratory –Originally, it was a front-end to FORTRAN matrix routines developed in the U. of New Mexico and Stanford –Today.
Course contents 1.Labview basics – virtual instruments, data flow, palettes 2.Structures – for, while, case,... – editing techniques 3.Controls&Indicators.
Week 7 - Wednesday.  What did we talk about last time?  Introduction to arrays  Lab 6.
Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4.
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
FOR 520: Geospatial data analysis with Matlab
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
ENGR 6806 – Motor Control Prepared By: Rob Collett September 15, Office: EN2074.
ORTOP WORKSHOP 3 ROBOT NAVIGATION & MISSIONS ORTOP WORKSHOP 3 ROBOT NAVIGATION & MISSIONS.
1 Engineering Report Organization 1) title page 2) abstract or executive summary 3) front matter 4) introduction 5) technical sections 6) conclusions 7)
Math 15 Lecture 7 University of California, Merced Scilab A “Very” Short Introduction.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
MATLAB Tutorial EE 327 Signals and Systems 1. What is MATLAB? MATLAB – Matrix Laboratory The premier number-crunching software Extremely useful for signal.
Numerical Computation Lecture 2: Introduction to Matlab Programming United International College.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
Computer Programming 12 Mr. Jean May 8 th, The plan: Video clip of the day Upcoming Assessment Bot.java.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2010.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
1. 2 QUIZ PREP l Have Quiz sheet ready. Title = QUIZ 9 »Name (L, F, MI), »Today’s date 10/16/12, »Lab day, time »section number Lab Day/TimeSection Number.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
Introduction to MATLAB 7 MATLAB Programming for Engineer Hassan Migdadi Spring 2013.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
SIMULINK-Tutorial 1 Class ECES-304 Presented by : Shubham Bhat.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2012.
Array Creation ENGR 1187 MATLAB 2. Today’s Topics  Arrays: What are they?  Vectors  Matrices  Creating Arrays.
1. 2 Quiz Preparation l Have Quiz sheet ready. Title = QUIZ 6 »Name (L, F, MI), »Today’s date 9/25/12, »Lab day, time »section number Lab Day/TimeSection.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
1. 2 Quiz Preparation l Have Quiz sheet ready. l Top Center: QUIZ 2 l Upper Right: »Name (L, F, MI), »Today’s date 8/28/12 »Lab day, time »section number.
Engineering Reports Report organization Writing style
C Programming Lecture 1 : Introduction Bong-Soo Sohn Associate Professor School of Computer Science and Engineering Chung-Ang University.
Introduction to Matlab Module #8 Page 1 Introduction to Matlab Module #8 – Animation Topics 1.getframe 2.pause 3.Plotting a set of files Textbook Reading.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
CS 122 Engineering Computation Lab Lab1 Bruce Char Department of Computer Science Drexel University Summer 2009 ©By the author. All rights reserved. Permission.
An Introduction to Programming in Matlab Emily Blumenthal
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
1-2 What is the Matlab environment? How can you create vectors ? What does the colon : operator do? How does the use of the built-in linspace function.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Announcements Have Quiz sheet ready. Title = QUIZ 7 Name (L, F, MI),
Introduction to Matlab
Linear Algebra Review.
ORTOP Workshop 3 Robot Navigation & Missions
Week 7 - Wednesday CS 121.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Use of Mathematics using Technology (Maltlab)
Communication and Coding Theory Lab(CS491)
Matlab Basics Tutorial
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Presentation transcript:

1 Quiz Preparation l Quiz 4 sheet provided. l Fill in your Name, etc. l Date is 9/11/12 l Answer questions during lecture. Lab Day/TimeSection Number Mon. 1:008 Mon. 3:009 Wed. 1:0010 Wed. 3:0011 Fri. 1:0012 Lab Day/TimeSection Number Mon. 1:008 Mon. 3:009 Wed. 1:0010 Wed. 3:0011 Thu. 2:0029 Fri. 1:0012 Lab Day/TimeSection Number Mon. 1:008 Mon. 3:009 Tue. 2:0036 Wed. 1:0010 Wed. 3:0011 Thu. 2:0035 Fri. 1:0012

2 Lego Car Project l Wirelessly driven Lego car l Left and right channels/motors for steering l Goal is to navigate and finish course as quickly as possible l Penalty of 1 second for each 0.5 V over 10V in voltage regulator output

3 Lego Car Overview Receiver R 1, R 2 PPM PWM

START/ FINISH BLOCK Required Gates Optional Gates (+5 sec. penalty if missed) Push block across finish line or incur a +30 sec. penalty Each floor tile is 1 foot × 1 foot square

5 Penalties l Penalties are a way to introduce “cost” into the design and cause the team to make tradeoff decisions. »Incurring a penalty should not be considered unethical or “wrong” in any sense. l 5 second penalty for missing an optional gate l 30 second penalty if the block is not pushed across the finish line l Penalty of 1 second for each 0.5 V over 10V in voltage regulator output (V o ). Voltages rounded to nearest 0.1 V. »V o ≤10.0V = no penalty »10.0V < V o ≤10.5V = 1 second penalty »10.5V < V o ≤11.0V = 2 second penalty »etc.

6 Competition Grading l Fastest time = 100 points »Fastest time ever (Spring 11) was 7 sec. =“World Record” l 30 seconds = 75 points l Other times linearly interpolated between fastest time and 30 sec. l Maximum time is 60 seconds

7 Preliminary Design Report l Due week of Lab 10, in lab. l Describe design decisions »Output voltage »Power supply »Wheel size/gears, etc. l Justify your decisions. l Explain any disadvantages, and why you’ll tolerate them. l Include supporting drawings, figures, and tables if needed.

8 Lego Car Design l Output voltage »Higher output voltage increases speed »Penalties apply above 10V l Power supply (batteries) »One 9V battery (light, but less than 10V) »Two 9V batteries (≥10V, but heavy) »Watch batteries (very light, but drain quickly) l Wheel size and gears »Torque vs. speed tradeoff l Drive strategy »Front wheel vs. rear wheel drive l Course path »Passing through all gates vs. missing gates »Pushing block vs. not pushing block l Body »Light vs. heavy

9 Today’s Topics l Introduction to MATLAB l MATLAB graphics l Image processing

10 MATLAB l MATLAB® allows us to work with large amounts of data easily. »The basic data structure in MATLAB is a vector. »A vector is a convenient way to store a sequence or array of numbers, such as sensor readings. l We can also manipulate sounds and images from within MATLAB.

11 MATLAB Basics l Assign a value to a variable >> a=3 a = 3 >> a=3; >> a a = 3 >> Semicolon suppresses echo Typing a variable name displays the value Be careful!!

12 MATLAB Basics l Vectors >> v=[1,3] v = 1 3 >> v=[1;3] v = 1 3 >> v' ans = 1 3 >> v=1:0.5:3 v = Comma delimits columns Semicolon delimits rows Apostrophe means transpose (turn rows into columns and vice versa) start value : increment : end value

13 l Sine wave: l is the frequency of the sine wave. l Sample the waveform every T seconds. »Let »We get a sequence »Let n=0,…,N to get sequence corresponding to a duration of NT seconds. Generating Sine Waves

14 MATLAB >> f0=100; >> T=.0008; >> n=0:62; >> x=sin(2*pi*f0*T*n); >> stem(n,x) start value : end value (assumes increment of 1) stem(n,x) plot(n,x)

15 MATLAB vs. C l C code to create a sine wave: #include main(argc,argv) int argc; char *argv[]; { int i,n; double *sv, f0; n=5000; f0=100; sv = (char *) calloc(n, double); for (i = 0; i < 50000; i++) { sv(i) = sin(2* *f0*I/44100); }

16 Other MATLAB Abilities l Many built-in functions l Can easily add your own functions l Immediate results without compiling l Can solve systems of equations easily l All kinds of plotting methods l Simulink l Maple Symbolic Math Toolbox

17 Example – Large Array l M file “multiplies.m” creates a 1000 x 1000 array, and then computes inverse. l Performs order of one billion FLOPS in a few seconds.

18 Example – 3D Plots l M-file “surfaces.m” creates a 3D “landscape” using the function z=cos(.05*x).*sin(.1*y) l This can be rotated in 3D with the mouse.

19 Example – Image Processing l Start with photo “office.jpg” l Convert to grayscale image l Detect edges

20 Image processing commands i=imread('office.jpg'); % convert to MATLAB format igray=i(:,:,1); % keep only one color channel bw=edge(igray,'canny'); % perform Canny edge detection

21 Playing Sounds in MATLAB l Can play sounds directly from MATLAB: »sound(x,44100) –x is the sequence of values in a vector –44100 is the output sampling rate »soundsc(x,44100) –Same as sound() but auto-levels before playing –Each sound played at the same level

22 Playing Sounds in MATLAB l Can read or write WAV files: »y = wavread(‘fast.wav’); –y is the sound sequence read in as a vector –fast.wav is the name of the file to be read. »wavwrite(y,44100,’fast.wav’)

23 Stereo in MATLAB l If x is an Nx2 vector, the left column will be played as the left channel, and the right column will be played as the right channel. »fl=200; »fr=300; »t=[0:1/44100:8]; »xl = sin(2*pi*fl*t); »xr = sin(2*pi*fr*t); l sound([xl’ xr’],44100)