Lecture+08+Presentation

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

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

View Full Document Right Arrow Icon
14:440:127 Introduction to Computers for Engineers Lecture 8 Lecturer: Brenda Cortez Recitation Instructors: Yun, Bo, Karthik, Muhammad 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
Rutgers School of Engineering LEC08 14:440:127 Today ʼ s Topics Animation using loops User-defned Functions Anonymous Functions 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Rutgers School of Engineering LEC08 14:440:127 Animation 4
Background image of page 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])
Background image of page 5

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

View Full DocumentRight Arrow Icon
Rutgers School of Engineering LEC08 14:440:127 Animation Demo 6
Background image of page 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
Background image of page 7

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

View Full DocumentRight Arrow Icon
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
Background image of page 8
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:
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online