Bonjour,
Affichage symétrique :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 clear Te=1/12000; f1=440; f2=440; phi2=2*pi*rand(1); t=0:Te:0.02; A1=randi([1,10]); A2=randi([1,10]); x1=A1*cos(2*pi*f1*t); x2=A2*cos(2*pi*f2*t+phi2); % Normalisation x1=A1*cos(2*pi*f1*t)/max(x1); x2=A2*cos(2*pi*f2*t+phi2)/max(x2); N = length(x1); % Test du maximum for k = 1: N-1 for n = 1 : N-k-1 inter(n) = x1(n)*x1(n+k); end Cxx(k) = 1/N*sum(inter); end % Maximum de référence MaxCxx=max(Cxx); m=0; for k=0:100 p=0; for t = 0:Te: 0.02 p=p+1; inter(p)=A1*cos(2*pi*f1*t)*A2*cos(2*pi*f2*(t-k*Te)+phi2); end m=m+1; Cxx(p) = 1/p*sum(inter(1:end-3)); end % Test des maxima - Seuil à ajuster if MaxCxx - max(Cxx) > 0.1 disp('signaux DIFFERENTS') else disp('signaux PROCHES') end t=0:Te:0.02; figure(1) plot(t,x1,t,x2) grid k=1:10; t = 0:Te: 0.02; figure(2) plot(-t,Cxx,t,Cxx,'b') ; grid axis([-t(end) t(end) min(Cxx(1:end-1)) max(Cxx(1:end-1))])
Partager