File:Produit convolution carre cercle.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 720 × 720 pixels, file size: 44 KB)

Captions

Captions

Convolution product of a rectangular function and a half-circle function.

Summary[edit]

Description
Français : Produit de convolution d'une fonction porte et d'une fonction demi-cercle.
English: Convolution product of a rectangular function and a half-circle function.
Date
Source Own work
Author Cdang
W3CiThe source code of this SVG is invalid due to 9 errors.
Created with Matplotlib-logo 
This W3C-invalid plot was created with Matplotlib.
W3C red 
The source code of this SVG is invalid due to 9 errors.
Python-logo-notext 
This W3C-invalid vector image was created with Python by cdang.

Source code

InfoField

Python code

import numpy as np
import matplotlib.pyplot as plt

n = 1000 # nombre de points
xmin = -2 # limites du calcul
xmax = 2
x = np.linspace(xmin, xmax, n)
dt = (xmax - xmin)/n # pas

def cercle(x):
    """Fonction cercle (équation cartésienne)"""
    bool = np.logical_and(x >= -1, x <= 1)
    y = np.zeros_like(x)
    y[bool] = np.sqrt(1 - x[bool]*x[bool])
    return y

def porte(x):
    """Fonction porte"""
    bool = np.logical_and(x >= -1, x <= 1)
    y = np.zeros_like(x)
    y[bool] = 1
    return y

y1 = cercle(x)
y2 = porte(x)

plt.figure(figsize = [8, 8])
plt.rcParams["text.usetex"] = True

# Tracé des fonctions
plt.subplot(2, 1, 1)
plt.plot(x, y1, label="$f$")
plt.plot(x, y2, label="$g$")
plt.xlabel("$x$")
plt.ylabel("$y$")
plt.gca().set_aspect("equal", adjustable="box")
plt.legend()

# Calcul du produit de convolution
X = np.linspace(xmin - xmax, xmax - xmin, 2*n - 1)
Y = dt*np.convolve(y1, y2)

# Tracé du produit de convolution
plt.subplot(2, 1, 2)
plt.plot(X, Y, label="$f*g$")
plt.xlabel("$x$")
plt.ylabel("$y$")
plt.legend()

plt.suptitle("Produit de convolution")

plt.savefig("produit_convolution_carre_cercle.svg", format="svg")

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current08:29, 25 October 2023Thumbnail for version as of 08:29, 25 October 2023720 × 720 (44 KB)Cdang (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata