Echantillonnage
1 - Chaine de traitement numérique
Analyse Spectrale au cours de la chaine de traitement :
2 - Définition
3 - Transformée de Fourier d’un Signal Echantillonné ( Analyse Fréquentielle )
Périodicité du Spectre
Sachant que
Illustration
Prenons l’exemple de la sinusoïde échantillonnée :
Si j’ajoute progressivement les composantes issues de la série de fourier, nous voyons que la forme mathématique de notre
signal échantillonné apparait progressivement en faisant tendre N vers l’infini.
Les composantes résultent de la périodicité du spectre .
Conséquence : Repliement du spectre (aliasing)
Considérons un signal d’entrée un peu bruité.
La périodisation du spectre engendre l’accumulation de ce bruit sur toute la bande passante.
Le signal échantillonné est donc noyé dans le bruit.
Conséquence : Il est nécessaire de filtrer le signal analogique d’entrée.
La fréquence de coupure du filtre doit être Fe/2 ( fréquence de Shannon ).
4 - Transformée de Laplace d’un Signal Echantillonné
Reprenons le cas du signal échelon ; on observe une périodisation de la transformée de Laplace selon la composante
5 - Transformée en Z
Reprenons la transformée de Laplace d’un signal échantillonné :
posons
Dès lors nous appelons transformée en Z :
Noté également ( sous entendu avec période d’échantillonage :
La transformée en z correspond donc à la transformée de Laplace d’un système échantillonné . Le changement de variable entre s et z nous permettra d’exploiter les calculs de séries mathématiques.
Quant à l’analyse d’un système, elle se fait désormais dans le plan des z :
Comme on est sur une fonction périodique, on retrouve la même chose tous les , d’où le cercle.
6 - Propriétés de la transformée en Z
6.1 - le retard
soit avec pour
est en retard de k échantillons par rapport à y.
représente donc un retard de k échantillons.
C’est l’un des points les plus importants : on peut trouver une relation entre les échantillons d’entrée et de sortie ( équation de récurrence ), directement à partir de la transformée en z.
6.2 - Théorème de la valeur finale
7 - Quelques transformées en Z
- Impulsion :
- Echelon :
- Exponentiel :
- sinus :
8 - Modèle du Bloqueur d’ordre zéro
9 - Approximation numérique de la dérivée
9.1 - Euler
Pour “petit” :
à
En Z :
représente donc la dérivée.
On en déduit que s peut être remplacé par pour passer de l’expression analogique en s à l’expression échantillonnée en z.
9.2 - Transformation bilinéaire ( méthode des trapèzes )
10 - Application : Réponse d’un système du 1er ordre
10.1 - Méthode de l’invariant indiciel ( modèle du bloqueur d’ordre 0 )
Système du premier ordre :
Transformation inverse (utilisation des tables) :
ou détermination de l’équation de récurrence :
Passage en :
pour
10.2 - Approximation de la dérivée par la méthode d’Euler
Dans le cas d’un système échantillonné :
( approximation méthode d’Euler )
L’équation devient :
On en déduit l’équation de récurrence :
pour
Cette équation de récurrence peut être déduite à partir de la fonction de transfert :
On retrouve :
REMARQUE : On peut trouver l’expression de y en passant par Z :
Repartons de l’équation différentielle “numérisée” :
avec et
Réponse Indicielle ( echelon)
Décomposition en éléments simples :
Utilisation des tables pour trouver
10.3 - Approximation de la dérivée par la transformation bilinéaire
avec et
Equation de récurrence :
10.4 - Résumé
11 - Script Scilab / octave-matlab pour générer les figures ci dessus :
SCILAB
figure(1)
//==============================================================================
// CHAINE DE TRAITEMENT NUMERIQUE
//==============================================================================
Npp=40 ; a=1; Nd=80; N=Npp*Nd;
Fe=16e3; Te=1/Fe; Fc=Fe*Npp; Tc=1/Fc; F=1000;
t=Tc*(0:N-1);
ve=5*sin(2*%pi*F*t);
d=[ones(1, a), zeros(1, (Npp-a))];
imp=matrix(d' *ones(1, Nd ), 1 , N);
se=ve .* imp;
// réponse impulsionnelle du bloqueur
b=ones(1, Npp);
// signal en sortie du bloqueur, réajusté sur N points
v1= convol(b,se);
v1=v1(1 : N);
// calcul du filtre passe bas, butteworth d'ordre 8
G=analpf(8,'butt',[0 0],2*%pi*(0.4*Fe));
f=Fc/N*[0 : N-1];
GAIN=freq(G(2),G(3),%i*2*%pi*f);
G=[GAIN(1:N/2), conj(GAIN(N/2+1:-1:2))];
hpb=fft(G, 1);
// filtrage
v2=convol(hpb, v1); v2=v2(1:N);
//==============================================================================
// Display
//==============================================================================
t_min=0
t_max=0.004
y_min=-6
y_max=6
subplot(4,2,1)
plot2d(t,ve);
p = get("hdl")
p.children.thickness = 3;
p.children.foreground = 5;
a=gca();
a.data_bounds=[t_min,t_max,y_min,y_max];
a.x_location = "origin";
a.y_location = "origin";
xtitle("temp signal","t (s)","amp (V)");
plot2d2(t,imp);
xtitle("Input signal, Dirac","t (s)","amplitude (V)")
subplot(4,2,2)
Fs=640000
S1=1/N*fft(ve,-1);
S=[S1(N/2+1:N), S1(1:N/2)];
f=(Fs/N)*[-N/2 : N/2-1];
plot2d3(f,abs(S),5)
p = get("hdl");
p.font_foreground=2;
p.font_style=5;
p.children.thickness = 3;
p.children.foreground = 3;
a=gca();
a.x_location = "origin";
a.y_location = "origin";
a.data_bounds=[-3*F,3*F,0,2.5]; // f_min,f_max,yf_min,yf_max
xtitle("spectrum analysis"," fréquency (Hz)","amp (Vs)");
//------------------------------------------------------------------------------
subplot(4,2,3)
plot2d2(t,se);
p = get("hdl")
p.children.thickness = 3;
p.children.foreground = 9;
a=gca();
a.data_bounds=[t_min,t_max,y_min,y_max];
a.x_location = "origin";
a.y_location = "origin";
xtitle("temp signal","t (s)","amp (V)");
xtitle("Sampled signal","t (s)","amplitude (V)");
subplot(4,2,4)
Fs=640000
S1=1/N*fft(se,-1);
S=[S1(N/2+1:N), S1(1:N/2)];
f=(Fs/N)*[-N/2 : N/2-1];
plot2d3(f,abs(S),5)
p = get("hdl");
p.font_foreground=2;
p.font_style=5;
p.children.thickness = 3;
p.children.foreground = 3;
a=gca();
a.x_location = "origin";
a.y_location = "origin";
a.data_bounds=[-2*Fe,2*Fe,0,0.1]; // f_min,f_max,yf_min,yf_max
xtitle("spectrum analysis"," fréquency (Hz)","amp (Vs)");
//------------------------------------------------------------------------------
subplot(4,2,5)
plot2d2(t,v1);
p = get("hdl")
p.children.thickness = 3;
p.children.foreground = 5;
a=gca();
a.data_bounds=[t_min,t_max,y_min,y_max];
a.x_location = "origin";
a.y_location = "origin";
xtitle("Bloqued Signal","t (s)","amplitude (V)")
subplot(4,2,6)
Fs=640000
S1=1/N*fft(v1,-1);
S=[S1(N/2+1:N), S1(1:N/2)];
f=(Fs/N)*[-N/2 : N/2-1];
plot2d3(f,abs(S),5)
p = get("hdl");
p.font_foreground=2;
p.font_style=5;
p.children.thickness = 3;
p.children.foreground = 3;
a=gca();
a.x_location = "origin";
a.y_location = "origin";
a.data_bounds=[-10*Fe,10*Fe,0,1]; // f_min,f_max,yf_min,yf_max
xtitle("spectrum analysis"," fréquency (Hz)","amp (Vs)");
//------------------------------------------------------------------------------
subplot(4,2,7)
plot2d2(t,v2);
p = get("hdl")
p.children.thickness = 3;
p.children.foreground = 5;
a=gca();
a.data_bounds=[t_min,t_max,y_min,y_max];
a.x_location = "origin";
a.y_location = "origin";
xtitle("Analog Filtered output signal","t (s)","amplitude (V)");
subplot(4,2,8)
Fs=640000
S1=1/N*fft(v2,-1);
S=[S1(N/2+1:N), S1(1:N/2)];
f=(Fs/N)*[-N/2 : N/2-1];
plot2d3(f,abs(S),5)
p = get("hdl");
p.font_foreground=2;
p.font_style=5;
p.children.thickness = 3;
p.children.foreground = 3;
a=gca();
a.x_location = "origin";
a.y_location = "origin";
a.data_bounds=[-2*Fe,2*Fe,0,2.5]; // f_min,f_max,yf_min,yf_max
xtitle("spectrum analysis"," fréquency (Hz)","amp (Vs)");
//==============================================================================
// PERIODISATION DU SPECTRE : ILLUSTRATION
//==============================================================================
figure(2)
t=0:0.0001:3;
F=1
Fe=10
omega=2*%pi*F
N_vect=[3 10 50 1000]
for i=1:4
//-----------------------------------------------------------------------------
subplot(2,2,i)
N=N_vect(i)
s = 0//cos(omega*t)
for k=0:N
s= s + (1/N)*(0.5*cos(2*%pi*(k*Fe-F)*t)+0.5*cos(2*%pi*(k*Fe+F)*t));
end
plot2d(t,s)
p = get("hdl");
p.children.thickness = 2;
p.children.foreground = 5;
title([['$y(t)=cos( \omega nT_e)$'], ' deduced from Fourier Serie with N=',string(N),' Terms'],'FontSize',4);
xlabel('t','FontSize',4);
ylabel('y(t)','FontSize',4);
//-----------------------------------------------------------------------------
end
//==============================================================================
// SIGNAL CARRE ECHANTILLONNE
//==============================================================================
N = 1000;
nd=100
Te=10e-3
Fe=1/Te
t=Te*(-N/2: N/2-1);
f=1
T=1/f
tau=0.5
t_min=-4
t_max=4
y_min=-0.1
y_max=1.2
f_min=-50
f_max=50
yf_min=0
yf_max=0.7
//------------------------------------------------------------------------------
subplot(2,2,1)
duty=100*(tau/T)
square =0.5 *( squarewave(2*%pi*f*t,duty) + 1)
plot(t,square)
p = get("hdl");
p.children.thickness = 4;
p.children.foreground = 5;
a=gca();
a.data_bounds=[t_min,t_max,y_min,y_max];
a.x_location = "origin";
a.y_location = "origin";
xtitle("temp signal","t (s)","amp (V)");
subplot(2,2,2)
S1=1/N*fft(square,-1);
S=[S1(N/2+1:N), S1(1:N/2)];
f=(Fe/N)*[-N/2 : N/2-1];
plot2d2(f,abs(S))
p = get("hdl");
p.font_foreground=2;
p.font_style=5;
p.children.thickness = 3;
p.children.foreground = 3;
a=gca();
a.x_location = "origin";
a.y_location = "origin";
a.data_bounds=[f_min,f_max,yf_min,yf_max];
xtitle("spectrum analysis"," fréquency (Hz)","amp (Vs)");
//------------------------------------------------------------------------------
subplot(2,2,3)
Nd=100
Npp=N/Nd
d=[ones(1, a), zeros(1, (Npp-a))];
imp=matrix(d' *ones(1, Nd ), 1 , N);
se=square .* imp;
plot2d2(t,se);
p = get("hdl")
p.children.thickness = 3;
p.children.foreground = 9;
a=gca();
a.data_bounds=[t_min,t_max,y_min,y_max];
a.x_location = "origin";
a.y_location = "origin";
xtitle("Sampled signal","t (s)","amplitude (V)");
subplot(2,2,4)
S1=10*1/N*fft(se,-1);
S=[S1(N/2+1:N), S1(1:N/2)];
f=(Fe/N)*[-N/2 : N/2-1];
plot2d2(f,abs(S))
p = get("hdl");
p.font_foreground=2;
p.font_style=5;
p.children.thickness = 3;
p.children.foreground = 3;
a=gca();
a.x_location = "origin";
a.y_location = "origin";
a.data_bounds=[f_min,f_max,yf_min,yf_max];
xtitle("spectrum analysis"," fréquency (Hz)","amp (Vs)");
MATLAB / OCTAVE
G=10
tau=1
Te=0.1
N=50
v_time=0:Te:(N-1)*Te;
% Analog Output
plot(v_time,G*(1-exp(-v_time/tau)));
hold on;
%-------------------------------------------------------------------------------
% FIRST METHOD : Zero Order Blocker
%-------------------------------------------------------------------------------
% Output
for n=0:N-1
y(n+1)=G*(1-exp(-n*Te));
end
stem(v_time,y)
hold on
% recurrence relation
yn_1=0
yn(1)=0
for n=1:N-1
yn(n+1)=yn_1*exp(-Te/tau)+G*(1-exp(-Te/tau));
yn_1=yn(n+1);
end
# stem(v_time,yn)
# hold on
%-------------------------------------------------------------------------------
% SECOND METHOD : Euler Approx
%-------------------------------------------------------------------------------
K1=Te/(tau+Te)
K2=1-K1
for n=0:N-1
y2(n+1)=G*(1-K2^(n));
end
stem(v_time,y2)
hold on
%-------------------------------------------------------------------------------
% THIRD METHOD : Bilinear Approx
%-------------------------------------------------------------------------------
K1=1+2*tau/Te
K2=2*tau/Te-1
% recurrence relation
yn_1=0
ybn(1)=0
for n=1:N-1
ybn(n+1)=yn_1*(K2/K1)+G/K1+G/K1;
yn_1=ybn(n+1);
end
stem(v_time,ybn)
hold on
%-------------------------------------------------------------------------------
legend('analog','zero order blocker','euler approx','bilinear transform')
# print -dsvg ../illustrations/temp_fo.svg