Q:

Write a script that will start with a rounded rectangle. Change both the x and y axes from the default to go from 0 to 3

0

Write a script that will start with a rounded rectangle. Change both the x and y axes from the default to go from 0 to 3. In a for loop, change the position vector by adding 0.1 to all elements 10 times (this will change the location and size of the rectangle each time). Create a movie consisting of the resulting rectangles. The final result should look like the plot shown in the Figure

Figure Curved rectangles produced in a loop 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Ch12Ex22.m

% Displays a series of rounded rectangles

posvec = [0.2, 0.2, 0.5, 0.8];

rh = rectangle('Position', posvec,...

 'Curvature',[0.5, 0.5]);

axis([0 3 0 3])

set(rh,'Linewidth',3,'LineStyle',':')

for i = 1:10

 posvec = posvec + 0.1;

 rh = rectangle('Position', posvec,...

 'Curvature',[0.5, 0.5]);

 axis([0 3 0 3])

 set(rh,'Linewidth',3,'LineStyle',':')

end

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now