Difference between revisions of "UTS Fakhri Saputra"

From ccitonlinewiki
Jump to: navigation, search
Line 1: Line 1:
  
3. A
+
3.  
 +
 
 +
A
  
  
Line 6: Line 8:
  
 
g = 9.82
 
g = 9.82
 +
 
a = 0
 
a = 0
 +
 
m1 = eval(input("massa benda 1 (kg): "))
 
m1 = eval(input("massa benda 1 (kg): "))
 +
 
m2 = eval(input("massa benda 2 (kg): "))
 
m2 = eval(input("massa benda 2 (kg): "))
 +
 
m3 = eval(input("massa benda 3 (kg): "))
 
m3 = eval(input("massa benda 3 (kg): "))
 +
 
u1 = eval(input("koefisien gesek benda 1: "))
 
u1 = eval(input("koefisien gesek benda 1: "))
 +
 
u2 = eval(input("koefisien gesek benda 2: "))
 
u2 = eval(input("koefisien gesek benda 2: "))
 +
 
u3 = eval(input("koefisien gesek benda 3: "))
 
u3 = eval(input("koefisien gesek benda 3: "))
 +
 
alphadeg = eval(input("sudut kemiringan (degrees): "))
 
alphadeg = eval(input("sudut kemiringan (degrees): "))
 +
 
alpha = (alphadeg / 180) * pi
 
alpha = (alphadeg / 180) * pi
 +
 
sina = sin(alpha)
 
sina = sin(alpha)
 +
 
cosa = cos(alpha)
 
cosa = cos(alpha)
 +
 
b1 = m1 * g * (sina + u1 * cosa) + m1 * a
 
b1 = m1 * g * (sina + u1 * cosa) + m1 * a
 +
 
b2 = m2 * g * (sina + u2 * cosa) + m2 * a
 
b2 = m2 * g * (sina + u2 * cosa) + m2 * a
 +
 
b3 = m3 * g * (sina + u3 * cosa) + m3 * a
 
b3 = m3 * g * (sina + u3 * cosa) + m3 * a
  
Line 26: Line 42:
  
 
t = linalg.solve(kt, b)
 
t = linalg.solve(kt, b)
 +
 
t1 = t[0]
 
t1 = t[0]
 +
 
t2 = t[1]
 
t2 = t[1]
 +
 
t3 = t[2]
 
t3 = t[2]
  
 
print(f't1 = {t1}, t2 = {t2}, t3 = {t3}')
 
print(f't1 = {t1}, t2 = {t2}, t3 = {t3}')
  
 
+
[[File:Video_kasus_pertama_mfs.mkv]]
  B.  
+
   
 +
B.  
  
 
from math import *
 
from math import *
  
 
g = 9.81
 
g = 9.81
 +
 
m = eval(input("massa mobil (kg): "))
 
m = eval(input("massa mobil (kg): "))
 +
 
cd = eval(input("koefisien drag: "))
 
cd = eval(input("koefisien drag: "))
 +
 
ut = eval(input("koefisien gesek roda: "))
 
ut = eval(input("koefisien gesek roda: "))
 +
 
amobil = eval(input("percepatan mobil (m/s^2): "))
 
amobil = eval(input("percepatan mobil (m/s^2): "))
 +
 
vmax = eval(input("kecepatan yang dicapai (km/h): "))
 
vmax = eval(input("kecepatan yang dicapai (km/h): "))
 +
 
v = vmax * (1000 / 3600)
 
v = vmax * (1000 / 3600)
 +
 
vo = 0
 
vo = 0
 +
 
to = 0
 
to = 0
 +
 
h = 0.01
 
h = 0.01
  
 
fmob = m * a
 
fmob = m * a
 +
 
fges = ut * m * g
 
fges = ut * m * g
 +
 
fdr = cd * v ** 1.5
 
fdr = cd * v ** 1.5
 +
 
atot = (fmob - fges - fdr) / m
 
atot = (fmob - fges - fdr) / m
  
Line 71: Line 103:
 
 
 
 
 
print(f'waktu yang dibutuhkan untuk mencapai {vmax} km/h adalah {rungekutta(vo, to, v, h)}')
 
print(f'waktu yang dibutuhkan untuk mencapai {vmax} km/h adalah {rungekutta(vo, to, v, h)}')
 +
 +
[[File:Video_kasus_2_mfs.mkv]]

Revision as of 00:33, 30 October 2019

3.

A


from numpy import *

g = 9.82

a = 0

m1 = eval(input("massa benda 1 (kg): "))

m2 = eval(input("massa benda 2 (kg): "))

m3 = eval(input("massa benda 3 (kg): "))

u1 = eval(input("koefisien gesek benda 1: "))

u2 = eval(input("koefisien gesek benda 2: "))

u3 = eval(input("koefisien gesek benda 3: "))

alphadeg = eval(input("sudut kemiringan (degrees): "))

alpha = (alphadeg / 180) * pi

sina = sin(alpha)

cosa = cos(alpha)

b1 = m1 * g * (sina + u1 * cosa) + m1 * a

b2 = m2 * g * (sina + u2 * cosa) + m2 * a

b3 = m3 * g * (sina + u3 * cosa) + m3 * a

b = array([b1, b2, b3], float)

kt = array([[1, 0, 0], [-1, 1, 0], [0, -1, 1]], float)

t = linalg.solve(kt, b)

t1 = t[0]

t2 = t[1]

t3 = t[2]

print(f't1 = {t1}, t2 = {t2}, t3 = {t3}')

B.

from math import *

g = 9.81

m = eval(input("massa mobil (kg): "))

cd = eval(input("koefisien drag: "))

ut = eval(input("koefisien gesek roda: "))

amobil = eval(input("percepatan mobil (m/s^2): "))

vmax = eval(input("kecepatan yang dicapai (km/h): "))

v = vmax * (1000 / 3600)

vo = 0

to = 0

h = 0.01

fmob = m * a

fges = ut * m * g

fdr = cd * v ** 1.5

atot = (fmob - fges - fdr) / m

def f(v, t): return (v / atot) - t


def rungekutta(vo, to, v, h):

	n = int((v - vo)/h)
	t = to
	for i in range(1, n + 1):
		k1 = h * f(vo, t)
		k2 = h * f(vo + 0.5 * h, t + 0.5 * k1)
		k3 = h * f(vo + 0.5 * h, t + 0.5 * k2)
		k4 = h * f(vo + h, t + k3)
		t = t + (1 / 6) * (k1 + 2 * k2 + 2 * k3 + k4)
		vo = vo + h
	return t
	
	

print(f'waktu yang dibutuhkan untuk mencapai {vmax} km/h adalah {rungekutta(vo, to, v, h)}')

File:Video kasus 2 mfs.mkv