Calcul d'un produit de convolution pour les systèmes linéaires et invariants dans le temps continus

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • SLIT https: • Systèmes Linéaires et ... Causalité&stabilité : • Causalité et stabilité...
    Produit de convolution discret : • Exemples de calcul d'u...
    Code matlab
    clear all; close all; clc;‎
    N=300; T=3;Te=1; ‎
    ‎X=rand(N,1); t_x=(0:N-1)*Te;‎
    ‎h=(1/T)*ones(T,1);t_h=(0:T-1)*Te;‎
    subplot(3,1,1); plot(t_x,X); subplot(3,1,2); stem(t_h,h,'r');‎
    Y=conv(X,h); t_y=(1-T:N-1)*Te; ‎
    ‎subplot(3,1,3); plot(t_y,Y); axis([0 N min(Y) max(Y)]);‎
    Code python
    import numpy as np; import matplotlib.pyplot as plt
    N = 50; A=4; Te=0.1; t = np.linspace(0, N*Te, N)‎
    x = A*np.concatenate((np.zeros(20),np.ones(10),np.zeros(20))) ‎
    plt.figure(1)‎
    plt.subplot(221); plt.plot(x); plt.grid(True); plt.xlabel('S'); plt.ylabel('Amp')‎
    plt.subplot(222); plt.plot(t, x); plt.grid(True); plt.xlabel('S'); plt.ylabel('Amp')‎
    plt.subplot(223); plt.stem(t, x); plt.grid(True); plt.xlabel('S'); plt.ylabel('Amp')‎
    plt.show()‎
    tt=np.linspace((1-N)*Te, (N-1)*Te, 2*N-1); Rx=np.correlate(x,x,mode='full');‎
    plt.subplot(224); plt.title('Autocorr');plt.plot(tt, Rx); plt.grid(True); plt.xlabel('S'); ‎plt.ylabel('Amp')‎
    Energie=sum(abs(x)**2)‎

КОМЕНТАРІ • 6