Lecture+08+Presentation

# Lecture+08+Presentation - 14:440:127 Introduction to...

This preview shows pages 1–10. Sign up to view the full content.

14:440:127 Introduction to Computers for Engineers Lecture 8 Lecturer: Brenda Cortez Recitation Instructors: Yun, Bo, Karthik, Muhammad 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Rutgers School of Engineering LEC08 14:440:127 General Announcements HW01/PROJ01 - No more question will be addressed. EXAM01/HW02 - Any question must be addressed by no later than this Friday, October 29th MatLab Video tutorials posted on Sakai - ±nd in Announcements HW03 posted Monday - due on Friday, October 29th at 11PM two problems! 2 HW03 - graded by Monday, November 1 Tutoring - if you fail HW03, show up as DSV on Wednesday, November 3rd from 6:30pm - 8:00pm - I will have tutoring Exam02 - will begin next Thursday, November 4th
Rutgers School of Engineering LEC08 14:440:127 Today ʼ s Topics Animation using loops User-defned Functions Anonymous Functions 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Rutgers School of Engineering LEC08 14:440:127 Animation 4
Rutgers School of Engineering LEC08 14:440:127 Animation(1) We will start by using the plot , pause , and axis functions 5 for t=0:0.1:10 % notice the small interval x = t*cos(t); y = 5*sin(t); pause(0.05) % pausing for 0.05 seconds % if you don’t pause, you will see nothing plot(x,y, 'X' ) % using X as the marker, so it is visible axis([-20 20 -5 5]) % so that axes do not change end syntax -> pause(secs_to_pause) syntax -> axis([xmin xmax ymin ymax])

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Rutgers School of Engineering LEC08 14:440:127 Animation Demo 6
Rutgers School of Engineering LEC08 14:440:127 Animation(2) This time we still used the plot , pause , and axis functions BUT took advantage of vectorization 7 t = 0:0.1:10; x = t.*cos(t); % remember to do element-wise multiplication y = 5*sin(t); for k=1:length(t) % notice the small interval pause(0.05) % pausing for 0.05 seconds plot(x(k),y(k), 'X' ) % addressing vectors x and y using k axis([min(x) max(x) min(y) max(y)]) % using vectors x and y to % determine max/min end performed vector multiplication outside of the loop

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Rutgers School of Engineering LEC08 14:440:127 Animation(3) If we wanted to see the trajectory path of X, we would still need to use the plot , pause , and axis along with vectorization , BUT will also need to plot more than just the current value of the vectors x and y at k 8 t = 0:0.1:10; x = t.*cos(t); % remember to do element-wise multiplication y = 5*sin(t); for k=1:length(t) % notice the small interval pause(0.05) % pausing for 0.05 seconds plot(x(1:k),y(1:k),x(k),y(k), 'X' ) % addressing vectors x and y % from 1:k and plotting this % point at the same time with % the value in x and y at k axis([min(x) max(x) min(y) max(y)]) % using vectors x and y to % determine max/min end plot from 1 to k
Rutgers School of Engineering LEC08 14:440:127 Animation Movie It would be nice to save our animation as a video fle, so what do we do? Some useFul MatLab Functions needed are:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 40

Lecture+08+Presentation - 14:440:127 Introduction to...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online