implementation of generic transfer function using Matlab
<p>I would like to know can anyone tell me how to implement transfer function a1s+a2/(b1s+b2) using Matlab meaning with for loop in the discrete form not using tf([a1 a2],[b1 b2]). For example if I want to implement a1/s I know  I would do something like:</p>

<pre><code>value(n)=value(n-1)+a1*fx*Ts;
</code></pre>

<p>where Ts is sampling frequency and fx is the function that needs to be integrated. for the a3*s I would do following:</p>

<pre><code>output=value(n)-lastvalue(n);
   lastvalue(n)=value(n);
</code></pre>

<p>But I am wondering how may I implement the generic (a1*s+a2)/(b1*s+b2)</p>

<p>Thanks</p>