필터 지우기
필터 지우기

How to make animation in MATLAB GUI...?

조회 수: 17 (최근 30일)
Rupesh Gosavi
Rupesh Gosavi 2014년 6월 5일
댓글: yeungor 2017년 11월 6일
I want to make animation of diagram or say real time change in diagram with respect to results I get. I also want to know the real time plot of graph. Please guide me with examples or videos.

답변 (1개)

Image Analyst
Image Analyst 2014년 6월 5일
That's the same thing my teenage son asked last night. What we did was to create a for loop, plot our functions inside the loop, then put in a pause of 0.1 seconds pause(0.1). The loop changed some parameter of the plot with each iteration and when the program ran, it gave the appearance of the lines on the plot changing and moving. For what it's worth, here is his code
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 13;
for p=0:100
p
for x=-20:50
y(x+21)=(x-2)^2-3;
y2(x+21)=2*x^3-4*x^2+3*x+15;
y3(x+21)=3*x^2+5*x+130*sin(x+p);
end
y4=-y3
plot(y,'bo-','linewidth',3,'markersize',5)
hold on
plot(y2,'rp-','linewidth',3,'markersize',5)
plot(y3,'kd-','linewidth',3,'markersize',5)
plot(y4,'kd-','linewidth',3,'markersize',5)
grid on
if p==0
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
end
ylim([-1000,1400])
caption=sprintf('%d',p);
title(caption,'fontsize',25);
legend('y1','y2','y3','y4')
drawnow
pause(0.1)
hold off
end
Not too bad for someone who just finished 10th grade.
  댓글 수: 4
Mosen shk
Mosen shk 2017년 3월 19일
stupid program
yeungor
yeungor 2017년 11월 6일
@Mosen, you're picking on a 10th grader. You could at least give constructive criticism, but it's probably pointless, I'm pretty sure Image Analyst could give his son better advice any day of the week.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by