Skip to content

Instantly share code, notes, and snippets.

Avatar

Michy mick001

View GitHub Profile
@mick001
mick001 / dft_module.hpp
Created Mar 4, 2018
Header file for dft calculating C++ program.
View dft_module.hpp
#include<iostream>
#include<vector>
#include<fstream>
#include<complex>
using std::cout;
using std::cin;
using std::endl;
using std::vector;
using std::complex;
@mick001
mick001 / dft_main.cpp
Created Mar 4, 2018
Calculating DFT from its definition for an arbitrary signal in C++.
View dft_main.cpp
/*
===============================================================================
Include statements
===============================================================================
*/
#include<complex>
#include<vector>
#include<string>
#include<dft_module.hpp>
View reddit_reading_bot.py
#!usr/bin/python3
"""
Created on Mon Sep 4 15:06:35 2017
@author: Michy
"""
import os
import praw
View dwg_to_pdf_printing_bot.py
# Imports
import os
import sys
import time
import psutil
import logging
import pyautogui as pgui
from datetime import datetime
@mick001
mick001 / balancing_ball_beam.m
Last active Jan 13, 2020
Balancing a ball on a beam article code.
View balancing_ball_beam.m
k = -7.0071;
s = tf('s');
G = k/s^2;
% PD controller
R = -(0.38 + 0.5*50/(1+50/s));
% Design a PD controller for the unit feedback loop
L = series(R,G);
sys = feedback(L, 1);
@mick001
mick001 / DC_motor.m
Last active Jan 13, 2020
Matlab state space model simulation of a DC motor
View DC_motor.m
% Motor params
R = 5.5; % [Ohm]
L = 0.0028; % [H]
phi = 0.5; % [Wb]
k = 1; % []
J = 0.5; % [kg m^2]
Cr = 0.1; % [Nm] Assumed Cr constant.
V = 24; % [V] Nominal voltage
% Building the system
@mick001
mick001 / taylor_series_improved.py
Last active Sep 22, 2021
Revised and improved version of Taylor series with Python and Sympy. You can find the original post at http://firsttimeprogrammer.blogspot.com/2015/03/taylor-series-with-python-and-sympy.html
View taylor_series_improved.py
import sympy as sy
import numpy as np
from sympy.functions import sin, cos, ln
import matplotlib.pyplot as plt
plt.style.use("ggplot")
# Factorial function
def factorial(n):
if n <= 0:
return 1
@mick001
mick001 / gist:6e141072685278148f82f60895f4e537
Created Aug 4, 2017
Revised and improved version of Taylor series with Python and Sympy. You can find the original post at http://firsttimeprogrammer.blogspot.com/2015/03/taylor-series-with-python-and-sympy.html
View gist:6e141072685278148f82f60895f4e537
import sympy as sy
import numpy as np
from sympy.functions import sin, cos, ln
import matplotlib.pyplot as plt
plt.style.use("ggplot")
# Factorial function
def factorial(n):
if n <= 0:
return 1
@mick001
mick001 / qnet_videos_pictures.R
Last active Mar 5, 2017
Save a plot for each observation then make a video out of it! Full article at: https://firsttimeprogrammer.blogspot.com/2017/03/resizing-spatial-data-in-r.html
View qnet_videos_pictures.R
# Load required libraries
require(dplyr)
require(raster)
require(rasterVis)
require(ncdf4)
# Clean workspace
rm(list = ls())
# Open nc file and get the data
@mick001
mick001 / expand_resolution.R
Last active Nov 3, 2017
How to change the resolution of your spatial data in R? Here's how! Full article at: https://firsttimeprogrammer.blogspot.com/2017/03/resizing-spatial-data-in-r.html
View expand_resolution.R
# We want more resolution for our data!
require(sp)
require(ncdf4)
require(gstat)
require(raster)
require(rasterVis)
# Clear workspace
rm(list=ls())