Skip to content

Instantly share code, notes, and snippets.

View mick001's full-sized avatar

Michy mick001

View GitHub Profile
@mick001
mick001 / dft_module.hpp
Created March 4, 2018 11:52
Header file for dft calculating C++ program.
#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 March 4, 2018 11:50
Calculating DFT from its definition for an arbitrary signal in C++.
/*
===============================================================================
Include statements
===============================================================================
*/
#include<complex>
#include<vector>
#include<string>
#include<dft_module.hpp>
#!usr/bin/python3
"""
Created on Mon Sep 4 15:06:35 2017
@author: Michy
"""
import os
import praw
@mick001
mick001 / dwg_to_pdf_printing_bot.py
Created September 3, 2017 21:22
Dwg to pdf printing bot.
# 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 January 13, 2020 00:36
Balancing a ball on a beam article code.
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 January 13, 2020 00:36
Matlab state space model simulation of a DC motor
% 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 March 5, 2022 07:29
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
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 August 4, 2017 16:50
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
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 March 5, 2017 08:43
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
# 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 November 3, 2017 08:58
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
# We want more resolution for our data!
require(sp)
require(ncdf4)
require(gstat)
require(raster)
require(rasterVis)
# Clear workspace
rm(list=ls())