% function visslinger(p, theta) % % Teken slinger simulatie. % % p de stapgrootte % theta de hoek op elke stap function visslinger(p, theta) delete(timerfind('Tag', 'Slinger')); T = timer('TimerFcn', {@plotpos, theta, p}, ... 'Period', p, ... 'TasksToExecute', length(theta), ... 'BusyMode', 'drop', ... 'ExecutionMode', 'fixedRate', ... 'Tag', 'Slinger'); start(T) function plotpos(T, Ev, theta, p) j = get(T, 'TasksExecuted'); figure(30) clf hold on; axis([-1.2 1.2 -1.2 1.2]) axis square axis off set(gca, 'XTick', []) set(gca, 'YTick', []) set(gca, 'Color', 'none') title(sprintf('%.2f sec, {\\theta} = %.2f{\\pi} = %.2f', (j-1)*p, theta(j)/pi, theta(j))) plot([0 -sin(theta(j))], [0 -cos(theta(j))], 'd-') plot([-sin(theta(j))], [-cos(theta(j))], 'o', 'Markersize', 30) drawnow if j == length(theta), stop(T); delete(T); end;