GithubHelp home page GithubHelp logo

fourier-visualization's Introduction

Fourier-visualization

傅里叶变换可视化

效果图:

fuliye.gif 心形

配置

使用了pygame

pip3 install pygame
or
pip3 install pygame -i https://mirrors.aliyun.com/pypi/simple

因为我电脑的屏幕分辨率比较小,所以你可能需要修改一些参数来适应屏幕。

运行

# 绘制波形
python3 fuliye.py
# 绘制二维图形
python3 fuliye2.py

运行后可以:

  • 左右键:加速/减速
  • +/-键:放大/缩小
  • L/K键:波形图放大/缩小

函数(fuliye.py)

将你想要显示的波形函数以这种形式写在fourier_list(代码中第37行)中。 例如:

f(x) = 1*sin(x) + (1/3)*sin(3x) + (1/5)*sin(5x) + ...

这是一个方形波 我们将其参数写在fourier_list中。

fourier_list = [
    [1    ,  1, 0],
    [1 / 3,  3, 0],
    [1 / 5,  5, 0],
    [1 / 7,  7, 0],
    [1 / 9,  9, 0],
    [1 /11, 11, 0],
    [1 /13, 13, 0],
    [1 /15, 15, 0],
    [1 /17, 17, 0],
    [1 /19, 19, 0]
]

当然,你也可以继续追加,让它更逼近方形波。

或者这样:

fourier_list = []
for i in range(1,1000,2):
    fourier_list.append([1/i,i,0])

还有锯齿波:

fourier_list = []
for i in range(1,1000,1):
    fourier_list.append([1/i,i,0])

=== 更新 === 新写了一个函数:get_wave 具体用法参见代码中的示例

函数

参见代码中的示例

fourier-visualization's People

Contributors

vacanthusky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fourier-visualization's Issues

画图问题请教

您好,我是来自**杭州的一名深度学习从业人员,看了您的仓库,对傅里叶画图非常有兴趣,但是我有一些疑问,所以冒昧打扰请教您一下:
我看网上的傅里叶画图例子,基本都是一笔画,就是一笔把原图画出来,对那些比较复杂的原图,这会在画图过程中产生一些跳跃的细节,假设我原图里面有两只蝴蝶,怎么用两笔把它画出来 ?或者,即便只有一个对象,我也仍想用多笔进行绘画,比如我想用一笔画蝴蝶的一个翅膀,另一只笔用来画另一只翅膀,这样的话我觉得整个绘画过程会更简洁,不必要的细节更少,整个绘画过程也更容易控制,所以如何让傅里叶可以支持用户自定义的画笔数量?
最后,会话结束后,如何去掉画图时使用的画笔,也就是只留下画出来的结果。
这两个问题我特别想向您请教,非常期待你的解答,不胜感激

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.