sync
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import scipy.signal as sig
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import sounddevice as sd
|
||||
import math
|
||||
|
||||
# simple first order step response simulation
|
||||
@@ -32,8 +33,11 @@ import math
|
||||
f_1 = 440 # fundamental frequency
|
||||
def f_n(n):
|
||||
return f_1 * n
|
||||
omega_1 = 2*math.pi*f_1
|
||||
b = 0.01
|
||||
def omega_n(n):
|
||||
return 2*math.pi*f_n(n) # a cooler option would be omega_n = c*n*omega_1*sqrt(1+B*n^2) to factor in string stiffness to its vibration mode
|
||||
# return 2*math.pi*f_n(n) # a cooler option would be omega_n = c*n*omega_1*sqrt(1+B*n^2) to factor in string stiffness to its vibration mode
|
||||
return 1.001*omega_1*math.sqrt(1+b*n**2)
|
||||
|
||||
# x = [ q1, q1dot, q2, q2dot, q3, q3dot ]^T < --state vector
|
||||
omega_1 = omega_n(1)
|
||||
@@ -52,7 +56,7 @@ A = [
|
||||
] # isnt this formatting gorgeous
|
||||
|
||||
B = [ [0], [0.707], [0], [0], [0], [-0.707] ]
|
||||
c_1 = 0.001
|
||||
c_1 = 0.0001
|
||||
c_2 = c_1 / 2
|
||||
c_3 = c_1 / 3
|
||||
C = [[-c_1*omega_1**2, -2*c_1*zeta_1*omega_1, -c_2*omega_2**2, -2*c_2*zeta_2*omega_2, -c_3*omega_3**2, -2*c_3*zeta_3*omega_3]]
|
||||
@@ -80,3 +84,6 @@ plt.xlabel("t")
|
||||
plt.ylabel("y")
|
||||
plt.grid()
|
||||
plt.show()
|
||||
|
||||
sd.play(y, 44100)
|
||||
sd.wait()
|
||||
|
||||
Reference in New Issue
Block a user