Files
matlab/common/l17.m
T
jens b31f3e7435 - added
git-svn-id: http://moon:8086/svn/matlab/trunk@153 801c6759-fa7c-4059-a304-17956f83a07c
2021-03-22 20:28:22 +00:00

52 lines
2.3 KiB
Matlab
Executable File

% ##################################################################################
% ## Loesung: Remez-Entwurf (Tschebyscheff-Approximation) ##
% ##################################################################################
% ##### Teilaufgabe a: Filter entwerfen #####
f = [0 0.3 0.5 1.0];
g = [1 1 0 0];
v_m=[9 10]; % Vektor mit den Filterordnungen
for m=v_m
b = remez(m,f,g); [H W] = freqz(b,1,512);
string = sprintf('Gewuenschte/Aktuelle Antwort - Filterordnung: %d', m);
figure;plot(f,g,W/pi,abs(H));
line([0 0.3],[ 2-max(abs(H)) 2-max(abs(H))],'linestyle','--');
line([0 0.5],[max(abs(H)) max(abs(H))],'linestyle','--');
line([0.5 1],[max(abs(H(400:length(H)))) max(abs(H(400:length(H))))],...
'linestyle','--');
line([0.3 0.3],[ 2-max(abs(H)) 0],'linestyle','--');
line([0.5 0.5],[ max(abs(H)) max(abs(H(400:length(H))))],'linestyle','--');
grid; xlabel('Omega/pi'); ylabel('|H(exp(j*Omega))|'); title(string);
end;
% ##### Teilaufgabe b: Frequenzgang wichten #####
f = [0 0.3 0.5 1.0];
g = [1 1 0 0];
w = [ 0.5 2 ];
v_m=[9 10]; % Vektor mit den Filterordnungen
for m=v_m
b = remez(m,f,g,w); [H W] = freqz(b,1,512);
string = sprintf('Gewuenschte/Aktuelle Antwort - Filterordnung: %d', m);
figure; plot(f,g,W/pi,abs(H));
line([0 0.3],[ 2-max(abs(H)) 2-max(abs(H))],'linestyle','--');
line([0 0.5],[max(abs(H)) max(abs(H))],'linestyle','--');
line([0.5 1],[max(abs(H(400:length(H)))) max(abs(H(400:length(H))))],...
'linestyle','--');
line([0.3 0.3],[ 2-max(abs(H)) 0],'linestyle','--');
line([0.5 0.5],[ max(abs(H)) max(abs(H(400:length(H))))],'linestyle','--');
grid; xlabel('Omega/pi'); ylabel('|H(exp(j*Omega))|'); title(string);
end;
% ##### Teilaufgabe c: Tiefpass-Bandpass Kombination #####
f = [0 0.2 0.26 0.44 0.5 0.7 0.76 1]; % Vektor der Eckfrequenzen
g = [1 1 0 0 1 1 0 0]; % Vektor der Frequenzgaenge
w = [ 1 4 1 4]; % Vektor mit den Gewichten
m = 128; % Filterordnung
b = remez(m,f,g,w); [H W] = freqz(b,1,512);
figure; plot(W/pi,20*log10(abs(H)) );grid; xlabel('Omega/pi');
ylabel('|H(exp(j*Omega))| in dB'); title('TP-BP-Kombination');
% ##### EOF #####