Files
matlab/common/buch/l19.m
T
2022-06-30 13:32:40 +02:00

41 lines
1.8 KiB
Matlab
Executable File

% ##################################################################################
% ## Loesung: Entwurf eines Hilbert-Transformators (Remez-Verfahren) ##
% ##################################################################################
% ##### Teilaufgabe a: Hilbert-Transformator entwerfen #####
b1 = remez(30,[0.05 0.95],[1 1],'h');
b2 = remez(31,[0.05 1],[1 1],'h');
figure; [H1 W] = freqz(b1,1,512);plot(W/pi,abs(H1)); grid; xlabel('Omega/pi');
ylabel('|H_H(exp(j*Omega))|'); title('Filterordnung: 30 Typ II');
figure; [H2 W] = freqz(b2,1,512);plot(W/pi,abs(H2)); grid; xlabel('Omega/pi');
ylabel('|H_H(exp(j*Omega))|'); title('Filterordnung: 31 Typ IV');
figure; stem([0:30], b1); axis([0 30 -0.8 0.8]); grid; xlabel('k');
ylabel('Impulsantwort'); title('Filterordnung: 30 Typ II');
figure; stem([0:31], b2); axis([0 31 -0.8 0.8]); grid; xlabel('k');
ylabel('Impulsantwort'); title('Filterordnung: 31 Typ IV');
% ##### Teilaufgabe b: Ausgangssignal filtern #####
b = remez(30,[0.05 0.95],[1 1],'h');
Fs = 1000;
t = (0:1/Fs:2)';
x = sin(2*pi*50*t);
xh = filter(b,1,x);
figure, zplane(b); xlabel('Realteil'); ylabel('Imaginaerteil');
title('Pol-Nullstellen-Diagramm');
xd = [zeros(15,1); x(1:length(x)-15)]; % delay 15 samples
figure; plot(t(1:50),xd(1:50),t(1:50),xh(1:50),'--'); grid; xlabel('Zeit (sek)');
ylabel('Amplitude'); title(' - Eingangssig. -- Ausgangssig.');
% ##### Teilaufgabe c: Hilbert-Tranformierte berechnen #####
Fs = 1000;
t = (0:1/Fs:2)';
x = sin(2*pi*50*t);
y = hilbert(x);
figure; plot(t(1:50), real(y(1:50))); grid; hold on;
plot(t(1:50), imag(y(1:50)),'--'); xlabel('Zeit (sek)'); ylabel('Amplitude');
title('-- Hilbert-Transform. - Original');
% ##### EOF #####