vzoreček pro výpočet kv. rovnice poskytl Tomáš Studený xstude02@stud.fit.vutbr.cz % aux pro diskretni systemy %%%%%%%%%%%%%%%%%%%%%%%% H pro filtr 3 2 1 n = 0:2; Fs = 8000; gj0 = find(n==0); T = 1/Fs; x = [3 2 1]; subplot(311); stem(n,x); grid; title('h') f = -2*Fs:100:2*Fs; fn = f / Fs; Om = 2*pi*f; om = Om / Fs; % dtft X = zeros(size(om)); for ii=1:length(om) ejon = exp(j*om(ii).*n); X(ii) = sum(x .* ejon); end subplot(312); plot (om,abs(X)); grid; axis tight; title('module'); subplot(313); plot (om,angle(X)); grid; axis tight; title('phase'); print -depsc FIG/h.eps subplot(221); plot (om,abs(X)); grid; axis tight; title('normalized omega'); subplot(222); plot (Om,abs(X)); grid; axis tight; title('omega'); subplot(223); plot (fn,abs(X)); grid; axis tight; title('normalized f'); subplot(224); plot (f,abs(X)); grid; axis tight; title('f'); print -depsc FIG/hfs.eps %%%%%%%%%%%%%%%%% priklady filtry %%%%%%%%%%%%%%%%%%%%% H=freqz([1 0.5],[1],256); om=(0:255)/256 * pi; subplot(211); plot(om,abs(H)); grid subplot(212); plot(om,angle(H)); grid print -depsc FIG/h_1+0.5.eps zplane([1 0.5],[1]); print -depsc FIG/np_1+0.5.eps %%% iir n = 0:30; y= filter([1],[1 0.5],[1 zeros(1,30)]); stem(n,y); print -depsc FIG/imp_rek_1+0.5.eps H=freqz([1],[1 0.5],256); om=(0:255)/256 * pi; subplot(211); plot(om,abs(H)); grid subplot(212); plot(om,angle(H)); grid print -depsc FIG/h_rek_1+0.5.eps zplane([1],[1 0.5]); print -depsc FIG/np_rek_1+0.5.eps