python 卷积函数_用Python计算两个函数的卷积

本文介绍了如何使用Python来计算两个函数的卷积,内容源于对原文的翻译。
摘要由CSDN通过智能技术生成

python 卷积函数

What is a convolution? OK, that’s not such a simple question. Instead, I am will give you a very basic example and then I will show you how to do this in Python with actual functions.

什么是卷积? 好吧,这不是一个简单的问题。 相反,我将给您一个非常基本的示例,然后向您展示如何在Python中使用实际功能执行此操作。

So, suppose you have an object and a camera. The object is the Sun — which produces different frequencies of light at different intensities. You could consider this frequency distribution of intensities a function (I’m going to call this function f). Next, you have a camera. The camera isn’t perfect. It is more sensitive to different frequencies of light. I’ll call this camera frequency sensitivity the function g.

因此,假设您有一个对象和一个照相机。 对象是太阳,它以不同的强度产生不同频率的光。 您可以将这种强度的频率分布视为一个函数(我将其称为f )。 接下来,您有一个摄像头。 相机并不完美。 它对不同频率的光更敏感。 我将此相机频率灵敏度称为功能g

When you capture an image of the Sun with this camera, you get some data. That data shows the intensity of different frequencies of light — but this data depends on both the Sun (function f) AND the camera (function g). The data you get would be the convolution of f and g.

当使用此相机捕获太阳图像时,您将获得一些数据。 该数据显示了不同频率的光的强度,但是该数据取决于太阳(函数f )和相机(函数g )。 您获得的数据将是fg的卷积

OK, I’m not sure if that’s the best example of a convolution — but I’m going to move forward anyway. Actually, I’ve seen this awesome animation of a convolution and I think it helps explain the thing. I’ll go through the steps to make this down below.

好的,我不确定这是否是卷积的最佳示例-但我还是要继续前进。 实际上,我已经看过这种令人惊叹的卷积动画,并且我认为这有助于解释问题。 我将按照以下步骤进行操作。

Image for post

In this case, the red curve is one function and the blue is the other one. You can think of the convolution and as the area of amount the two functions overlap. So, as the two functions start to overlap the area in common increases up to the point where they are exactly on top of each other. Then the convolution starts to decrease as they are no longer completely overlapping.

在这种情况下,红色曲线是一种功能,而蓝色是另一种功能。 您可以想到卷积,并且随着数量的增加,两个函数重叠。 因此,当这两个功能开始重叠时,共同的面积会增加,直到它们恰好彼此重叠。 然后,由于卷积不再完全重叠,卷积开始减小。

Fine. But how do you calculate this stuff? One way to define the convolution is with the following integral.

精细。 但是,您如何计算这些东西呢? 定义卷积的一种方法是使用以下积分。

Image for post

Note that this is an

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值