How to make ball move in simulink

4 visualizaciones (últimos 30 días)
Juraj Jakubov
Juraj Jakubov el 30 de Oct. de 2020
Respondida: Anmol Dhiman el 9 de Nov. de 2020
i have simple sphere (ball) in matlab simulink.
And what i want to do is to make this ball goes around screen (from one corner to another). I was able to do this in matlab with circle in plot with this code. But now i need to do this in simulink.
% START MOVING BALL
X = 2;
Y = 2;
pH = plot(X,Y,'or','MarkerSize',20,'MarkerFaceColor','r');
axis([0 151 0 85])
axis off
for i=1:4560
if i < 1470
X = X + 0.1;
elseif i < 2280
Y = Y + 0.1
elseif i < 3750
X = X - 0.1;
elseif i < 4560
Y = Y - 0.1
end
set(pH,'XData',X,'YData',Y)
tic;while toc<0;end
drawnow
end
% END MOVING BALL
end
But i dont know how to do this in simulink cos i never work with this before. If u can point me somwhere or show me how to do it i will be verz thankful.

Respuesta aceptada

Anmol Dhiman
Anmol Dhiman el 9 de Nov. de 2020
Hi Juraj,
I think animations in simulink is what you are looking for.
Regards,
Anmol Dhiman

Más respuestas (0)

Categorías

Más información sobre Simulink 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