Let's consider we want to model a continuous time filter that has one zero at 30GH and two poles at 35GHz.

I also have a sampled waveform with sampling frequency of $f_s$, so the time interval between the samples is $T_s = 1/f_s$. Now I want to filter the waveform with filter that I just described. How can I do that?

Below is what I have tried, but the filtered output does not seem right. I appreciate if you let me know which step(s) are not done properly. I have written it in Matlab code so that you can try it for yourself.

% Define the baud rate
fb = 32e9;

% Calculate unit interval (UI)
ui = 1/fb;

% Define number of samples per UI
smpls_per_ui = 32;

% Calculate sampling interval and frequency
si = ui / smpls_per_ui;
fs = 1/si;

% Define an impulse response as the input waveform to the filter
ir = zeros(121*smpls_per_ui, 1);
ir(smpls_per_ui/2) = 2 / si;

% Define continuous system poles and zeros:
poles_c = [35e9; 35e9];
zeros_c = [30e9];
k_c     = 1;           %gain

% Convert poles and zeros to discrete system
poles_d = exp(poles_c*si);
zeros_d = exp(zeros_c*si);
k_d     = 1-exp(-k_c*si) ;

% Get the filter numerator and denominator from poles and zeros
[b,a] = zp2tf(zeros_d, poles_d, k_d);

% Apply the filte
ir_filtered = filter(b,a,ir);

% Plot
figure(1); clf; plot(ir, 'b'); hold on; plot(ir_filtered, 'r')
  • please use the code formatting button ({} right above the question editor) to format your souce code as source code, and then remove the empty lines to maximize readability. – Marcus Müller Dec 5 at 23:22
  • 1
    i don't wanna slug through this code. judging from the title, does the OP want to transform the continuous-time filter (with 2 poles and a zero) into a discrete-time filter so that the OP can run a discrete-time waveform through this filter? – robert bristow-johnson Dec 5 at 23:26
  • Yes, that is what I intend to do. The code is really simple and I am not sure which step is not done right. – shampar Dec 6 at 15:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.