Auto-Corrélation , corrélation et applications
Вставка
- Опубліковано 19 вер 2024
- Systèmes Linéaires et invariants : • Systèmes Linéaires et ...
Notions d'Energie et de Puissance : • Notions de Signal, Ene...
Codes Matlab
clc ; clear all ; close all ;
Te=0.1; N=50; A=4;
t=(0:1:N-1)*Te;
x=A*[zeros(1,20),ones(1,10),zeros(1,20)];
subplot(2,2,1);plot(x);
subplot(2,2,2);plot(t,x);
subplot(2,2,3);stem(t,x);
Rx= xcorr(x); tt=(-N+1:1:N-1)*Te;
subplot(2,2,4);plot(tt,Rx);
Energie=sum(x.^2)
-----------------------------------------------------------
clc ; clear all ; close all ;
N=500; x=zeros(N,1);x(1:10)=1;
figure; plot(x);axis([0 N 0 1.2]);legend('signal émis');
y=circshift(x,50);
y=y+0.4*randn(N,1);
figure; plot(y);legend('signal reçu: bruité et retardé de 50s')
Ryx=xcorr(y,x);Ryx=Ryx(N:end);
figure; plot(Ryx);
Codes 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.subplot(222); plt.plot(t, x);
plt.subplot(223); plt.stem(t, x);
tt=np.linspace((1-N)*Te, (N-1)*Te, 2*N-1);
Rx=np.correlate(x,x,mode='full');
plt.subplot(224);plt.plot(tt, Rx);
Energie=sum(abs(x)**2)
-----------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
N = 500; sigma = 0.5 ; mu = 0;
x = np.zeros(N); x[0:9]=1;
y = np.roll(x,50)+ sigma * np.random.randn(N) + mu
Ryx = np.correlate(y,x,mode='full');Ryx=Ryx[N-1:2*N-1]
plt.figure(1)
plt.subplot(131); plt.plot(x); plt.title('signal émis')
plt.subplot(132); plt.plot(y); plt.title('signal reçu')
plt.subplot(133); plt.plot(Ryx); plt.title('Intercorrélation entre signal émis et signal reçu')