How do I increase the circle size and animate a stick figure?

조회 수: 6 (최근 30일)
Zjuv9021
Zjuv9021 2019년 11월 20일
답변: darova 2019년 11월 20일
I have a line of code that generates a stick figure in 2D:
close all; clear all; clc
% Head
syms t
x(t) = sin(t);
y(t) = cos(t);
fplot(x,y+4, 'b', 'LineWidth',2)
axis([-10 10 -10 10])
hold on
grid on
% Stomach
fplot(2*x,2*y-2,'k','LineWidth',2)
% Body
syms t
x(t) = sym(0);
y(t) = t;
fplot(x,y,[-4 3], 'b', 'LineWidth',2)
% Legs
syms x
fplot(2*x-4, [-2 0],'b','LineWidth',2)
fplot(-2*x-4,[0 2],'b','LineWidth',2)
% Arms
fplot(sym(0), [-2 2],'b','LineWidth',2);
% Save Image
filename = 'Stickman.gif';
I am attempting to generate an animation (and save) utilizing the functions getframe and movie to display the "stomach" expanding.
Is there a simple way in which to do this?
Thank you

채택된 답변

darova
darova 2019년 11월 20일
Use for loop and pause
t = linspace(0,2*pi);
x = cos(t);
y = sin(t);
axis([-10 10 -10 10])
hold on
for i = 1:10
h = plot(i*x,i*y);
pause(0.5)
delete(h)
end
hold off

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by