% claculer TFD de filtre d'ordre 3 %y(n) = 1/3[u(n + 1) + u(n) + u(n − 1)] clc;close all; w = 0 : 0.01 : pi ; % H_mag=(1+2*cos(w))/3; % H_magdb=mag2db(H_mag); figure(1) subplot( 2 , 1 , 1 ) plot(w/pi, 20*log10(abs(1+2*cos(w))/3));%loglog(w, 20*abs(1+2*cos(w))/3) ylabel('Magnitude(dB)','FontSize',18);xlabel('$ Normalisation \; \omega \times \pi$','FontSize',12,'interpreter','latex') subplot( 2 , 1 , 2 ) plot(w/pi, -angle(1+2*cos(w))*180/ pi); %semilogx (w, angle(1+2*cos(w))*180/ pi ); ylabel('Phase','FontSize',18,'interpreter','latex');xlabel('$\omega \times \pi$','FontSize',12,'interpreter','latex') %% autre methode figure(2) b0=1/3; b1=[1, 1, 1]; a1=[0, 1]; freqz(b0*b1, a1)% la reponse frequentielle discret G_z=tf(b0*b1, a1,0.01); %% autre methode figure(3) Ts=0.01; %z = zpk('z',Ts); z=tf('z',Ts) H_z=(1/3)*(z+1+z^-1); num=cell2mat(H_z.num); den=cell2mat(H_z.den); freqz(num, den) % H_z.variable='z^-1' % zpk(H_z)