Pankaj(ADS)

Featured post

Python Codes for Electric Potential

Python Codes for Electric Potential Code:- import numpy as np import math import matplotlib.pyplot as plot ''' Calculating Elect...

Wednesday, 22 July 2020

Python Program(Four-Bar Link Mechanism)

0 comments
Python Program(Four-Bar Link Mechanism)
 For Automobiles         ;--

Python Code
import numpy as np
import math
import scipy as sp
import matplotlib.pyplot as plt
'''------------Pankaj Aswal-------------
       *---------*
      /             /
     /             /       Crank- Roacker Mechanism
    *---------*
---------------------------------------
'''

pi= math.pi
th = np.arange(0, 0.1, 8*pi);
a=10;
c=12;
d=14;
b=16; 
AC=print(math.sqrt(a*a+d*d-2*a*d*(math.cos(th))));
th_1= print(math.acos(1)); 
th_2= print(math.acos(1)); 
th_3= 0; 
x= plt.plot([0 ,a*(math.cos(th))], [0 ,a*(math.sin(th))],'b--'); 
y= plt.plot([a*(math.cos(th)) ,a*(math.cos(th))+ b*(math.cos(th_3))], [a*(math.sin(th)) ,a*(math.sin(th))+ b*(math.sin(th_3))], 'b--');  
plt.plot([0 ,d], [0 ,0], 'ro--'); 
plt.plot([d ,a*(math.cos(th))+ b*(math.cos(th_3))], [0 ,a*(math.sin(th))+b*(math.sin(th_3))], 'ro--'); 
plt.xlabel('Four_Bar Link Mechanism')
plt.ylabel('Crank Roacker')
plt.grid(True,which='both')
plt.title('Automobile')
plt.show()

Output
1.

No comments:

Post a Comment