I've got following problem:

assume you've this continous system 1st order:

$$ H(s) = \frac{1}{1+s} $$

s = tf('s');
sys = 1/(1+s);

I'm going to discretize this system via impulse invariant transformation and plot the results.

sysD = c2d(sys,1e-3,'impulse');
hold all;

enter image description here

So this seems to work.

If I try to create the impulse response for 7 seconds manually I use:

imp = zeros(1,7*1e3);
imp(1) = 1;
t = 0:1e-3:7-1e-3;
y = lsim(sys,imp,t);

enter image description here

Unfortunately this is not the response I expected. The gain seems to be scaled by the samplerate 1e3.

So the question is: What does impulse do since this response should be correct. lsim uses the filter command and simply passes the nominator and denominator to filter I think. Is the dirac impulse (or kronecker delta) wrong? Must it be scaled by the samplerate?

I discovered the whole thing, because I wanted to design a very simple digital filter. I knew the responses of time continuous systems, so I thought it would be easy to discretize the transfer function and use the coefficients of the digital transfer function that can be used by filter or in a dsp application.

What is wrong?

Thank you very much!


1 Answer 1


Indeed the lsim function is returning scaled values. You might also notice that it is connected to the gain $k$ of your filter:

[z,p,k] = tf2zpk(sysD.num{1}, sysD.den{1});

That will return:


You can scale it back by the sampling period as you noticed.

  • $\begingroup$ How to scale it back using OP lsim code? What should be modified? $\endgroup$
    – Unknown123
    Nov 20, 2018 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.