Giter Site home page Giter Site logo

michaelnaps / four Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 12.35 MB

For my personal study of simple real/complex Fourier methods and their application to various systems.

Python 93.86% Jupyter Notebook 6.14%
fourier-methods modeling system-identification fourier-animations

four's Introduction

Fourier Series and Animations

UNDER DEVELOPMENT

This small Python library was inspired by the 3Brown1Blue video linked here. After watching this video I took some time to remind myself of the structure of a Fourier series (which I, at one point, taught in ungrad.) before building the classes in the package FOUR.

The idea of a 2-D Fourier series is relatively simple. The general theory states that any function, $f$, which maps between two domains such that $f : \mathbb{X} \rightarrow \mathbb{Y}$ can be represented by an infinite sum of $\cos(x)$ and $\sin(x)$ terms.

$$ f(x) = \sum_{k=0}^\infty \left[ A_k \sin(\frac{\pi k x}{L}) + B_k \cos(\frac{\pi k x}{L}) \right] $$

Where $x \in \mathbb{X}$ and $f(x) \in \mathbb{Y}$.

References:
    A. Gilat and V. Subramaniam, Numerical methods for engineers and
        scientists: an introduction with applications using matlab, 3. ed.
        Hoboken, NJ: Wiley, 2014.

Imprinting Temporal-dynamics onto a Grid

In this quick example I have imprinted the motion of the duffing oscillator (as begun from a single set point) onto a grid. Each space can be made visible or invisible dependent on whether the point is present in that cell. That is,

$$ c_{i,j} = \begin{cases} 1 & \text{if $x(t)$ is present} \\ 0 & \text{otherwise} \end{cases} $$

Where $c_{i,j}$ is the binary value for the $j$-th cell in the $i$-th row. The binary grid was saved at each step of the simulation and used to calculate the Fourier transform. This resulted in a playback that looks like...


Abby and Michael Simulated Trace

This started as a fun side project while working at iRobot in the Summer of 2023. Animations using Fourier transforms are not particularly difficult, but the exercise proved an interesting re-introduction to a topic I was enamored with at the time.

For Abby's birthday I traced an image using the tools in the drawdata folder of this repository to form a reference data set, and used the FOUR-package to create an animation of the lines drawn. For the purposes of the simulation I chose $N=50$ in my least-squares (LS) regression. The discrete fourier transform (DFT) is also a method in this library, but was not used here as I wanted to filter out some of the hard-edges from my trace. The first image shows the reference...

And the second shows the resulting animation (plus I gave myself sunglasses)...

NOTE: Simulation is very smooth when not formatted as a .gif file.

four's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.