# Code Examples (Digital Signal Processing)

## Matlab file for the effects of quantization on filter design

%**************************************************************************
% Design parameters
%**************************************************************************
N   =  8;     % Filter order
f_c =  0.1;   % Normalized cut-off frequency (0 ... 1)
R_p =  0.5;   % Ripple in dB in passband
R_s = 80;     % Stopband attenuation in dB

%**************************************************************************
% Design of an elliptic lowpass filter
%**************************************************************************
[b,a] = ellip(N, R_p, R_s, f_c);

%**************************************************************************
% Show frequency response
%**************************************************************************
fig = figure(1);
set(fig,'Units','Normalized');
set(fig,'Position',[0.1 0.1 0.8 0.8]);
[H,Omega] = freqz(b,a,2048*4,'whole',2);
plot(Omega,20*log10(abs(H)+eps),'b','LineWidth',2);
grid on
axis([0 2 (-R_s -20) 20])
xlabel('Normalized frequency \Omega/\pi')
ylabel('dB')

%**************************************************************************
% Quantization
%**************************************************************************
B = 32; % Number of bits

a_max = max(abs(a));
b_max = max(abs(b));

a_q = round(a / a_max * 2^B) / 2^B * a_max;
b_q = round(b / b_max * 2^B) / 2^B * b_max;

%**************************************************************************
% Show frequency response of quantized filter
%**************************************************************************
[H_q,Omega] = freqz(b_q,a_q,2048*4,'whole',2);
hold on;
plot(Omega,20*log10(abs(H_q)+eps),'r','LineWidth',2);
hold off;
legend('Non-quantized',['Quantized with ',num2str(B),' bits'])

%**************************************************************************
% Show coefficients
%**************************************************************************
format long;
a
a_q
b
b_q

%**************************************************************************
%**************************************************************************
[sos,g] = tf2sos(b,a);

[L,L_tmp] = size(sos);

sos_q = round(sos / max(max(abs(sos))) * 2^B) / 2^B * max(max(abs(sos)));
g_q   = round(g^(1/L) * 2^B) / 2^B;

H_bq_q = freqz(g_q*sos_q(1,1:3),sos_q(1,4:6),2048*4,'whole',2);
for k = 2:L
H_bq_q = H_bq_q .* freqz(g_q*sos_q(k,1:3),sos_q(k,4:6),2048*4,'whole',2);
end;

%**************************************************************************
% Show frequency response of quantized biquad filters
%**************************************************************************
[H_q,Omega] = freqz(b_q,a_q,2048*4,'whole',2);
hold on;
plot(Omega,20*log10(abs(H_bq_q)+eps),'k','LineWidth',2);
hold off;
legend('Non-quantized',['Quantized with ',num2str(B),' bits'],...



## Filter design using linear prediction

{easycodeinc dss.tf.uni-kiel.de/images/teaching/lectures/digital_signal_processing/code_examples/filter_ana.m, 0}

### Website News

01.10.2017: Started with a Tips and Tricks section for KiRAT.

01.10.2017: Talks from Jonas Sauter (Nuance) and Vasudev Kandade Rajan (Harman/Samsung) added.

13.08.2017: New Gas e.V. sections (e.g. pictures or prices) added.

05.08.2017: The first "slide carousel" added.

### Recent Publications

J. Reermann, P. Durdaut, S. Salzer, T. Demming,A. Piorra, E. Quandt, N. Frey, M. Höft, and G. Schmidt: Evaluation of Magnetoelectric Sensor Systems for Cardiological Applications, Measurement (Elsevier), ISSN 0263-2241, https://doi.org/10.1016/j.measurement.2017.09.047, 2017

S. Graf, T. Herbig, M. Buck, G. Schmidt: Low-Complexity Pitch Estimation Based on Phase Differences Between Low-Resolution Spectra, Proc. Interspeech, pp. 2316 -2320, 2017

### Contact

Prof. Dr.-Ing. Gerhard Schmidt

E-Mail: gus@tf.uni-kiel.de

Christian-Albrechts-Universität zu Kiel
Faculty of Engineering
Institute for Electrical Engineering and Information Engineering
Digital Signal Processing and System Theory

Kaiserstr. 2
24143 Kiel, Germany

## Recent News

Jens Reermann Defended his Dissertation with Distinction

On Friday, 21st of June, Jens Reermann defended his research on signals processing for magnetoelectric sensor systems very successfully. After 90 minutes of talk and question time he finished his PhD with distinction. Congratulations, Jens, from the entire DSS team.

Jens worked for about three and a half years - as part of the collaborative research center (SFB) 1261 - on all kinds of signal ...