if (cond1) PowerPoint PPT Presentation

presentation player overlay
1 / 1
About This Presentation
Transcript and Presenter's Notes

Title: if (cond1)


1
Write a function that creates a movie of a random
walk that starts in the center of a 50x50 grid
and progresses in unit steps chosen randomly from
left, right, up and down gtgt walkMovie
randomWalk(300) gtgt movie(walkMovie, 4, 12)
rand(1) returns a single random number in the
range from 0 to 1 getframe takes a snapshot of
the contents of the current figure window reuse
x1,y1,x2,y2 to plot each new segment
function myMovie randomWalk (steps) figure axis(
0 50 0 50) axis equal hold on x1 25 y1
25 myMovie
(x2, y2)
1
  • if (cond1)
  • elseif (cond2)
  • else
  • end

(x1, y1)
Write a Comment
User Comments (0)
About PowerShow.com