Script posición y velocidad mecanismo biela manivela corredera
254l4Tarea1 de Mayo de 2021
355 Palabras (2 Páginas)105 Visitas
Página 1 de 2
									
	- clear
 - clc
 - l2=70;
 - l3=200;
 - %Eslabones
 - t2=[30:1:390]*pi/180;
 - t3=linspace(0,0,361);
 - l1=linspace(0,0,361);
 - t1=0;
 - %velocidades
 - w2=linspace(10*pi/30,10*pi/30,361);
 - w3=linspace(0,0,361);
 - v1=linspace(0,0,361);
 - %aceleraciones
 - at2=0;
 - at3=linspace(0,0,361);
 - a1=linspace(0,0,361);
 - %datos semilla
 - t3(1)=315*pi/180;
 - l1(1)=257;
 - w3(1)=1;
 - v1(1)=0.5;
 - at3(1)=1;
 - a1(1)=0.5;
 - tol=10^-5;
 - for i=1:1:361
 - dt3=tol;
 - dl1=tol;
 - while (abs(dt3)+ abs(dl1))>tol
 - B=[l2*cos(t2(i))+l3*cos(t3(i))-l1(i)*cos(t1);
 - l2*sin(t2(i))+l3*sin(t3(i))-l1(i)*sin(t1)];
 - A=[-l3*sin(t3(i)),-cos(t1);
 - l3*cos(t3(i)),-sin(t1)];
 - X=inv(A)*-B;
 - dt3=X(1);
 - dl1=X(2);
 - t3(i)=t3(i)+dt3;
 - l1(i)=l1(i)+dl1;
 - end
 - while or(t3(i)<0,t3(i)>2*pi)
 - if t3(i)<0
 - t3(i)=t3(i)+2*pi
 - else
 - t3(i)=t3(i)-2*pi
 - end
 - end
 - dw3=tol;
 - dv1=tol;
 - while (abs(dw3)+ abs(dv1))>tol
 - B=[-l2*sin(t2(i))*w2(i)-l3*sin(t3(i))*w3(i)-v1(i)*cos(t1);
 - l2*cos(t2(i))*w2(i)+l3*cos(t3(i))*w3(i)];
 - A=[-l3*sin(t3(i)),-cos(t1);
 - l3*cos(t3(i)),-sin(t1)];
 - X=inv(A)*-B;
 - dw3=X(1);
 - dv1=X(2);
 - w3(i)=w3(i)+dw3;
 - v1(i)=v1(i)+dv1;
 - end
 - dat3=tol;
 - da1=tol;
 - while (abs(dat3)+ abs(da1))>tol
 - B=[-l2*cos(t2(i))*w2(i)^2-l2*sin(t2(i))*at2-l2*cos(t2(i))*w3(i)^2-l3*sin(t3(i))*at3(i)-a1(i);
 - -l2*sin(t2(i))*w2(i)^2+l2*cos(t2(i))*at2-l2*sin(t2(i))*w2(i)^2+l3*cos(t3(i))*at3(i)
 - ];
 - A=[-l3*sin(t3(i)),-cos(t1);
 - l3*cos(t3(i)),-sin(t1)
 - ];
 - X=inv(A)*-B;
 - dat3=X(1);
 - da1=X(2);
 - at3(i)=at3(i)+dat3;
 - a1(i)=a1(i)+da1;
 - end
 - CX=[0;
 - l2*cos(t2(i));
 - l2*cos(t2(i))+l3*cos(t3(i));
 - ];
 - CY=[0;
 - l2*sin(t2(i));
 - 0;
 - ]
 - figure(1)
 - plot(CX,CY)
 - grid on
 - title('Animacion')
 - xlabel('Coordenada en x [mm]')
 - ylabel('Coordenada en y [mm]')
 - grid on
 - xlim([-80 300])
 - ylim([-80 100])
 - pause(0.05)
 - end
 - figure (2)
 - title('angulos')
 - subplot(2,1,1)
 - plot(t2,t3,'--r')
 - xlabel('theta 2 (rad)')
 - ylabel('theta 3 (rad)')
 - grid on
 - subplot(2,1,2)
 - plot(t2,l1)
 - xlabel('theta 2 (rad)')
 - ylabel('longitud 1 (mm) ')
 - grid on
 - figure (3)
 - title('velocidad')
 - subplot(2,1,1)
 - plot(t2,w3,'--g')
 - xlabel('theta 2 (rad)')
 - ylabel('velocidad w3')
 - grid on
 - subplot(2,1,2)
 - plot(t2,v1)
 - xlabel('theta 2 (rad)')
 - ylabel('velocidad v1 ')
 - grid on
 - figure (4)
 - title('aceleracion')
 - subplot(2,1,1)
 - plot(t2,at3,'--g')
 - xlabel('theta 1 (rad)')
 - ylabel('aceleracion at2')
 - grid on
 - subplot(2,1,2)
 - plot(t2,a1)
 - xlabel('theta 2 (rad)')
 - ylabel('aceleracion a1')
 - grid on
 - t3
 - disp("en grados")
 - disp(t3*180/pi)
 - l1
 - disp("en mm")
 - disp(l1)
 - esto es en matlab para hacer en matlab hay que usar matlab
 - e analisis no viene pq no me deja subirloo
 
...
Disponible sólo en Clubensayos.com