pend - xp=[0 10*sin(theta)]; yp=[0 -10*cos(theta)]; % draw...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [sys,x0]=pend(t,x,u,flag,plotit) f % % Draw the animation of a pendulum % % EE3530 % Course Project % % Daniel Campos-Delgado % Oct. 7th, 2000 % global Handles; g if abs(flag) == 0, sys=[0 1 0 1 0 0]; x0=0; if plotit, for i=1:length(Handles), set(Handles(i),'Visible','on'); end; end; elseif (flag == 2), theta=u; %set handles plh=Handles(1); pmh=Handles(2); poh=Handles(3); oh=Handles(4); % update the pendulum body using theta state
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: xp=[0 10*sin(theta)]; yp=[0 -10*cos(theta)]; % draw pendulum point mass using x & theta states xpm=10*sin(theta); ypm=-10*cos(theta); %draw k=1/sqrt(2); xop=0.8*[-1 -k 0 k 1]; yop=0.8*[0 -k -1 -k 0]; %reset picture set(oh,'XData',[0 0],'Ydata',[0 -13]); set(poh,'Xdata',xop,'Ydata',yop); set(plh,'Xdata',xp,'Ydata',yp); set(pmh,'Xdata',xpm,'Ydata',ypm); drawnow; else %nothig end; sys=0; else sys=; end;...
View Full Document

This note was uploaded on 12/01/2009 for the course S DS taught by Professor S during the Spring '09 term at Universidad Autonoma de Nuevo Leon - School of Business.

Ask a homework question - tutors are online