{ "metadata": { "name": "", "signature": "sha256:fc6923e502800422d1ca66394e71d567efb82c4dcd09c273561149f8d3b00fe5" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Complementary Filter" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Convert continuous transfer function into discrete\n", "\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import scipy.signal as sig\n", "from math import sqrt\n", "\n", "dt = 0.01\n", "ki = 0.1**2\n", "kp = sqrt(2)*0.1\n", "\n", "num = [kp, ki]\n", "den = [1, 0.]\n", "sig.cont2discrete(sys=(num,den), dt=0.1)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 8, "text": [ "(array([[ 0.14142136, -0.14042136]]), array([ 1., -1.]), 0.1)" ] } ], "prompt_number": 8 }, { "cell_type": "code", "collapsed": false, "input": [ "a = 5\n", "num = [a, 0]\n", "den = [a, 1]\n", "sig.cont2discrete(sys=(num,den), dt=0.1)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 11, "text": [ "(array([[ 1., -1.]]), array([ 1. , -0.98019867]), 0.1)" ] } ], "prompt_number": 11 }, { "cell_type": "code", "collapsed": false, "input": [ "from sympy import *\n", "from sympy.abc import *\n", "a = Symbol('a', positive=True)\n", "foo = (s/(s+a)).rewrite()\n", "print(foo)\n", "inverse_laplace_transform(1/((s+a)), s, t)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "s/(a + s)\n" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 39, "text": [ "exp(-a*t)*Heaviside(t)" ] } ], "prompt_number": 39 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }