This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install python3-pip tmux vim git jupyter podman nodejs virtualbox ruby xclip curl -y | |
sudo apt install python3.10-venv -y | |
pip3 install librosa tensorflow numpy matplotlib torch pandas virtualenv | |
# install go | |
wget https://go.dev/dl/go1.19.linux-amd64.tar.gz | |
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz | |
export PATH=$PATH:/usr/local/go/bin | |
sudo apt install gopls dlv -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Solving Z domain partial fraction with sympy | |
from sympy import * | |
z = symbols('z') | |
def inverse_z(h): | |
'''finds X(z)/z for the inverse z transform table look up | |
''' | |
h = h/z | |
h = h.apart() * z | |
return expand(h) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
from time import sleep | |
COM = '/dev/ttyUSB0' #This is for linuxm Will be COM# for windows copmuters so check ur usb port names | |
BAUD = 9600 | |
ser = serial.Serial(COM, BAUD, timeout = .1) | |
print('Waiting for device'); | |
sleep(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# paste all of this here: ~/.tmux.conf | |
# for copying to sys clipboard | |
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" | |
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" | |
bind -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" | |
#general other stuff | |
set -g default-terminal "xterm-256color" | |
set -g mouse on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# u can change the input type and response by uncommenting | |
## t the stions of the code that are below each subplot | |
clear; clc; | |
pkg load control; | |
K = 32.3; | |
s = tf('s'); | |
openLoopTf = K/( s*(s+3)*(s+6)); | |
##openLoopTf = (672*(s+5)) / (s*(s+6)*(s+7)*(s+8));; | |
## closed loop | |
## very important to follow this order for the input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tf_to_symbolic_fraction(tf): | |
x = symbols('x') | |
num, den = tfdata(tf) | |
num = num[0][0] | |
den = den[0][0] | |
counter = 1 | |
length_num = len(num) | |
length_den = len(den) | |
sym_num, sym_den = 0,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% referenced gist https://gist.github.com/akiatoji/5649907 | |
clear ; close all; clc | |
fundPeriod = pi/1000; | |
num_tsteps = 1000; | |
num_periods = 4; | |
tstep = num_periods * fundPeriod / num_tsteps; | |
t = 0:tstep:(num_periods * fundPeriod); | |
msg = 2*cos(400*t)+4*sin(500*t+pi/3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# percent overshoot to theta angle and zeta ratio calculator | |
# PD controller calculator | |
#so far can only find kp value for a PD controller | |
# numpy is weird it has ln has a log for some reason | |
from numpy import log as ln | |
from math import atan, sqrt, pi, degrees | |
from sympy import symbols, simplify, fraction,solve, pprint, evalf, im, I | |
from math import isclose |