Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
clc
clear all
b = 25; % distance between supports
d = 10;
tetp = 5; %angular speed of bar 1
teta = [0:1:360]*pi/180;
n = length(teta);
for i = 1:n
tet = teta(i)
er = [cos(tet) sin(tet)]'; %vector in radial direction
etet = [-sin(tet) cos(tet)]';
Rvect = [b+d*cos(tet) d*sin(tet)];
R = sqrt(dot(Rvect,Rvect));
v = d*tetp*etet; %velocity
a = -d*tetp^2*er; %acceleration
eR = Rvect'/R;
eAlfa = [-eR(2) eR(1)]';
K = [eR R*eAlfa];
RpAp = inv(K)*v;
Rp = RpAp(1);
Rpp(i) = Rp; %Rpunto
Ap = RpAp(2); %alfa punto
App(i) = Ap;
f = a + R*Ap^2*eR - 2*Rp*Ap*eAlfa;
R2pA2p = inv(K)*f;
R2p = R2pA2p(1);
R2pp(i) = R2p;
A2p = R2pA2p(2);
A2pp(i) = A2p;
end
teta = teta*180/pi;
plot(teta,Rpp,'k.')
figure(2)
plot(teta,App,'k+')
%legend('Rpunto','Alfa punto')
xlabel('teta(degrees)')
figure(3)
plot(teta,R2pp,'k.')
figure(4)
plot(teta,A2pp)
Matlab scrip donde se implementan el método de integración trapezoidal y el
método de Newton Rapzon
%Trapezoid rule
% clc
% clear all
% x0 = 0.00001;
% xf = 100;
% dx = 0.00001;
% x = [x0:dx:xf];
% n = (xf-x0)/dx;
% I = 0;
% for ik = 2:n
% xi = x(ik); x0 = x(ik-1);
% fi = 1/(sqrt(12*xi + 0.02*xi^2));
% f0 = 1/(sqrt(12*x0 + 0.02*x0^2));
% I = I + 0.5*dx*(fi+f0);
% end
% I
%%%%%%%%%%%%%%
%solve cosh(sqrt(0.02t))-1.3333=0
tn = 1;
rat = sqrt(0.02);
err=1
tol = 0.00001
cont = 0
while err>tol
tn = tn - (cosh(rat*tn)-1.3333)/(rat*sinh(rat*tn));
err = abs(cosh(rat*tn)-1.3333);
cont = cont + 1
if cont>100
error('There is no convergence')
end
end
tn
Scrip para resolver la velocidad y aceleración de un sistema mecánico. Debes agregar
este archivo para resolver otro problema. en un camino circular conducido por un
brazo excéntrico groved
end
an = Sdot.*Sdot/b; %normal acceleration
ac = [Sdot2' an'];
accel = sqrt(Sdot2.*Sdot2 + an.*an);
plot(theta,Sdot)
hold on
plot(theta,Rdot,'r--')
legend('Sdot','Rdot')
xlabel('Theta (rad)')
ylabel('Velocity components (m/s)')
figure (2)
plot(theta,Sdot2,'b.')
hold on
plot(theta,an,'r--')
plot(theta,accel,'k')
legend('Tangent','Normal','Total')
xlabel('Theta (rad)')
ylabel('Acceleration components (m/s^2)')
toc
Mecanismo Sliker-Crank cinemática.
%This script calculates the speed and velocity of the piston and
connecting
%rod of a slider-crank mechanism
clc
clear all
a = 3; %Crankshaft radius
b = 7; %Connecting rod length
w1 = 502.6;% Shaft angular speed (rad/s)
theta = [0:1:360]*pi/180; %Shaft angular position
n = length(theta);
w11 = [0 0 w1]; % Shaf angular velocity vector
for i = 1:n
th = theta(i);
alf = asin((a/b)*sin(th));
r1 = a*[cos(th) sin(th) 0];%vector of the shaft
r2 = b*[-cos(alf) sin(alf) 0];
VB = cross(w11,r1);
VB = VB(1:2); %Take only the i and j component
K = [1 -r2(2); 0 r2(1)];
VcW2 = inv(K)*VB';%vector containing Vc and w2
Vc(i) = VcW2(1);
w2 = VcW2(2);
w22(i) = w2;
aB = cross(w11,cross(w11,r1)); %Acceleration of B
f = aB' + w2^2*r2';
f = f(1:2);
aC_alfa2 = inv(K)*f;
aC(i) = aC_alfa2(1);
alfa2(i) = aC_alfa2(2);
pp = [0 0;r1(1:2)];
set(gcf,'position',[10,10,1000,533])%Set a good size of the figure
pp2 = [r1(1:2); (r1(1)-r2(1)), 0];
axis manual
pp2 = [r1(1:2); (r1(1)-r2(1)), 0];
plot(pp(:,1),pp(:,2),'ko-',pp2(:,1),pp2(:,2),'ro-');
AXIS([-4 11 -4 4])
pause(0.01)
end
theta = theta*180/pi;
figure(2)
plot(theta,Vc,'k')
hold on
plot(theta,w22,'r')
xlabel('Shaft angular position (Degrees)')
ylabel('Piston velocity (in/s); rod angular speed (rad/s)')
legend ('Piston velocity','Rod angular speed')
figure(3)
plot(theta,aC,'k')
hold on
plot(theta,alfa2,'ro')
xlabel('Shaft angular position (Degrees)')
ylabel('Piston acceleration (in/s2); rod angular acceleration (rad/s2)')
legend ('Piston acceleration','Rod angular acceleration')
Archivo para calcular fuerzas y momento en un mecanismo.
%File to solve a disc with a slider in a sloted arm.
clear all
clc
teta = [0:1:360]*pi/180; % Angular position of the crankshaft
n = length(teta);
w = 80; %disc angular speed
w1 = w*[0 0 1]; % disk angular velocity vector
mu = 0.2; %friction coefficient
W2 = 10; %lbf arm weight
m2 = W2/32.2;
W1 = 20; %disc weigth
m1 = W1/32.2; %disc weigth
s1 = 5/12; %pin-pivot distance in ft
s2 = 2; %horizontal distance between pivots
s3 = 15/12; %center of mass distance
k = 4.5/12; %radious of gyration
I = m2*k^2; %moment of inertia
w2 = zeros(1,n);
vrel = w2;
alfa = w2;
arel = w2;
N = w2;
Ax = w2; Ay = w2; M = w2;
for i = 1:n
tet = teta(i);
r1 = s1*[cos(tet) sin(tet) 0];
r2 = [(s2+s1*cos(tet)) s1*sin(tet) 0];
er = r2/sqrt(dot(r2,r2));
VB = cross(w1,r1);
VB = VB(1:2);
end
teta = 180*teta/pi;
plot(teta,Ax,'k')
hold on
plot(teta,Ay,'r.')
plot(teta,N,'c+')
%grid on
legend('Horizontal force','Vertical force','Pin normal force')
xlabel('Pin angular position (Degrees)')
ylabel('Force (lbf)')
figure(2)
plot(teta,M,'k')
xlabel('Pin angular position (Degrees)')
ylabel('Torque (lbf-ft)')
%grid on
Ejercicio Echeverry
clc
clear all
b = 3; %Longitud cuerpo 2
n = length(theta);
for i =1:n
M = ((-r1(2)*Rvar(2))-(Rvar(1)*r1(1))); %Determinante
alpha(i) = Alpha1;
Arel = ((-r1(2)*H(2))-(H(1)*r1(1)))/M; %Aceleracion relativa
R = (10*Rvar)-[6 0];
pp = [-6 0;R(1:2)];
set(gcf,'position',[10,10,1000,533])
axis manual
pp2 = [0 0;r2(1:2)];
plot(pp(:,1),pp(:,2),'ko-',pp2(:,1),pp2(:,2),'ro-');
axis([-9 10 -6 6])
pause(0.01)
end
theta = theta*180/pi;
figure(2)
plot(theta,w11,'k')
hold on
plot(theta,alpha,'r')