Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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 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 3 Lego Car Overview Receiver R 1, R 2 PPM PWM

4 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 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 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 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 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 9 Today’s Topics l Introduction to MATLAB l MATLAB graphics l Image processing

10 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 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 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 = 1.0000 1.5000 2.0000 2.5000 3.0000 Comma delimits columns Semicolon delimits rows Apostrophe means transpose (turn rows into columns and vice versa) start value : increment : end value

13 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 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 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*3.1415927*f0*I/44100); }

16 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 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 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 19 Example – Image Processing l Start with photo “office.jpg” l Convert to grayscale image l Detect edges

20 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 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 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 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)


Download ppt "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."

Similar presentations


Ads by Google