Borrar filtros
Borrar filtros

How to make animation in MATLAB GUI...?

17 visualizaciones (últimos 30 días)
Rupesh Gosavi
Rupesh Gosavi el 5 de Jun. de 2014
Comentada: yeungor el 6 de Nov. de 2017
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.

Respuestas (1)

Image Analyst
Image Analyst el 5 de Jun. de 2014
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 comentarios
Mosen shk
Mosen shk el 19 de Mzo. de 2017
stupid program
yeungor
yeungor el 6 de Nov. de 2017
@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.

Iniciar sesión para comentar.

Categorías

Más información sobre App Building en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by