Write a script that will start with a rounded rectangle.

4 ビュー (過去 30 日間)
Jabari Rozier
Jabari Rozier 2018 年 4 月 29 日
回答済み: Prajit T R 2018 年 5 月 2 日
Write a script that will start with a rounded rectangle. Change both the axes from the default to go from 0 to 3. In a 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 Figure
  1 件のコメント
Jan
Jan 2018 年 4 月 30 日
This is a homework question. So how can we help you? Surely the forum will not solve your homework, so please post, what you have tried so far and ask a specific question.

サインインしてコメントする。

回答 (1 件)

Prajit T R
Prajit T R 2018 年 5 月 2 日
Hi Jabari
This may not be exactly what you need, but I'm sure the following code can motivate you to write the code for your question.
r=1.5;
x=1.5;
y=1.5;
d = r*2;
px = x-r;
py = y-r;
h = rectangle('Position',[px py d d],'Curvature',[1,1]);
daspect([1,1,1]);
pause(1);
for i=1:10
h = rectangle('Position',[px+0.1*i py+0.1*i d+0.1*i d+0.1*i],'Curvature',[1,1]);
daspect([1,1,1]);
pause(1);
end
This code generates circles, but I guess it can be ported to suit your requirement.
Hope this helps.
Cheers

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by