Está en la página 1de 7

lb=input('Ingrese Longitud de Biela Lb: ');

lm=input('Ingrese Longitud de Manivela Lm: ');


n=0;
opc=0;
disp('MENU');
disp('[1] Graficar Ob vs Om y S vs Om');
disp('[2] Graficar b vs Om y vS vs Om, (m=cte)');
disp('[3] Graficar b vs Om y aS vs Om, (m=cte)');
disp('[4] Salir del Programa');
while opc~=4
opc=input('Seleccione Opcin: ');
switch opc
case 1
for thetam=0:20:360
n=n+1;
thetab=asin((lm/lb)*sin(thetam*pi/180));
thetabdeg=thetab*180/pi;
S=lm*cos(thetam*pi/180)+sqrt(lb^2(lm^2)*(sin(thetam*pi/180))^2);
if (lb^2-(lm^2)*(sin(thetam*pi/180))^2)>=0
figure (1)
hold on
plot(thetam,thetabdeg,'bx'),grid
title('Om vs Ob')
xlabel('Om')
ylabel('Ob')
figure (2)
hold on
title('Om vs S')
plot(thetam,S,'bx'),grid
xlabel('Om')
ylabel('S')
end
M(n,1)=thetam;
M(n,2)=thetabdeg;
M(n,3)=S;
end
M
case 2
thetamP=input('Ingrese Velocidad Constante: ');
for thetam=0:20:360
n=n+1;
thetab=asin((lm/lb)*sin(thetam*pi/180));

thetabdeg=thetab*180/pi;
S=lm*cos(thetam*pi/180)+sqrt(lb^2(lm^2)*(sin(thetam*pi/180))^2);
D=[lb*sin(thetab) 1;
lb*cos(thetab) 0];
f=[-lm*sin(thetam*pi/180)*thetamP;
lm*cos(thetam*pi/180)*thetamP];
X=(D^-1)*f;
thetabP=X(1);
SP=X(2);
if (lb^2-(lm^2)*(sin(thetam*pi/180))^2)>=0
figure (1)
hold on
plot(thetam,thetabP,'bx'),grid
title('Om vs b')
xlabel('Om')
ylabel('b')
figure (2)
hold on
title('Om vs SP')
plot(thetam,SP,'bx'),grid
xlabel('Om')
ylabel('SP')
end
N(n,1)=thetam;
N(n,2)=thetabdeg;
N(n,3)=S;
N(n,4)=thetabP;
N(n,5)=SP;
end
N
case 3
thetamDP=input('Ingrese Aceleracin Constante: ');
for thetam=0:1:360
n=n+1;
thetab=asin((lm/lb)*sin(thetam*pi/180));
thetabdeg=thetab*180/pi;
S=lm*cos(thetam*pi/180)+sqrt(lb^2(lm^2)*(sin(thetam*pi/180))^2);
thetamP=sqrt(2*thetamDP*(thetam*pi/180));
D=[lb*sin(thetab) 1;
lb*cos(thetab) 0];
f=[-lm*sin(thetam*pi/180)*thetamP;

lm*cos(thetam*pi/180)*thetamP];
V=D^(-1)*f;
thetabP=V(1);
SP=V(2);
A=(-lm*cos(thetam*pi/180)*(thetamP^2))+(lb*cos(thetab)*(thetabP^2))+(-lm*sin(thetam*pi/180)*thetamDP);
B=(lm*sin(thetam*pi/180)*(thetamP^2))+(lb*sin(thetab)*(thetabP^2))+(lm*cos(t
hetam*pi/180)*thetamDP);
E=[lb*sin(thetab) 1;
lb*cos(thetab) 0];
g=[A ;
B];
AC=E^(-1)*g;
thetabDP=AC(1);
SDP=AC(2);
if (lb^2-(lm^2)*(sin(thetam*pi/180))^2)>=0
figure (1)
hold on
plot(thetam,thetabDP,'r'),grid
title('Om vs b')
xlabel('Om')
ylabel('b')
figure (2)
hold on
title('Om vs SDP')
plot(thetam,SDP,'r'),grid
xlabel('Om')
ylabel('SDP')
end
O(n,1)=thetam;
O(n,2)=thetabdeg;
O(n,3)=S;
O(n,4)=thetabP;
O(n,5)=SP;
O(n,6)=thetabDP;
O(n,7)=SDP;
end
O
case 4
disp('Seleccion Salir')
end
end

PARA EL CASO DE VELOCIDAD CONSTANTE

N=
m

SP

0.0000

6.0000

1.0000

0.0000

20

9.8466

5.8205

0.9537

-2.0205

40

18.7472

5.3199

0.8090

-3.6111

60

25.6589

4.6056

0.5547

-4.4249

80

29.4987

3.8288

0.1995

-4.3322

100

29.4987

3.1342

-0.1995

-3.5463

120

25.6589

2.6056

-0.5547

-2.5033

140

18.7472

2.2557

-0.8090

-1.5312

160

9.8466

2.0617

-0.9537

-0.7157

180

0.0000

2.0000

-1.0000

0.0000

200

-9.8466

2.0617

-0.9537

0.7157

220

-18.7472

2.2557

-0.8090

1.5312

240

-25.6589

2.6056

-0.5547

2.5033

260

-29.4987

3.1342

-0.1995

3.5463

280

-29.4987

3.8288

0.1995

4.3322

300

-25.6589

4.6056

0.5547

4.4249

320

-18.7472

5.3199

0.8090

3.6111

340

-9.8466

5.8205

0.9537

2.0205

360

0.0000

6.0000

1.0000

0.0000

PARA EL CASO DE ACELERACION CONSTANTE

O=
m

SP

SDP

0.0000

6.0000

0.0000

0.0000

1.0000

0.0000

20

9.8466

5.8205

0.5635

-1.1937

0.7665

-5.7679

40

18.7472

5.3199

0.6759

-3.0173

0.0162

-8.6010

60

25.6589

4.6056

0.5676

-4.5281

-1.3027

-6.5582

80

29.4987

3.8288

0.2357

-5.1191

-2.9288

-0.3039

100

29.4987

3.1342

-0.2636

-4.6850

-4.1098

6.3383

120

25.6589

2.6056

-0.8028

-3.6228

-4.2696

9.9851

140

18.7472

2.2557

-1.2645

-2.3935

-3.5835

10.9532

160

9.8466

2.0617

-1.5938

-1.1960

-2.4516

11.2909

180

0.0000

2.0000

-1.7725

0.0000

-1.0000

12.5664

200

-9.8466

2.0617

-1.7819

1.3371

0.9186

15.7240

220

-18.7472

2.2557

-1.5852

3.0004

3.5510

21.1495

240

-25.6589

2.6056

-1.1353

5.1235

6.8751

27.4802

260

-29.4987

3.1342

-0.4250

7.5544

9.9673

29.2461

280

-29.4987

3.8288

0.4410

9.5769

11.1484

18.4313

300

-25.6589

4.6056

1.2693

10.1251

9.8419

-6.2420

320

-18.7472

5.3199

1.9118

8.5341

7.1507

-36.3075

340

-9.8466

5.8205

2.3233

4.9219

4.1367

-61.6854

360

0.0000

6.0000

2.5066

0.0000

1.0000

-75.3982

También podría gustarte