<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#330000">
    <div class="moz-cite-prefix">On 25/07/2012 00:16, steven hallacy
      wrote:<br>
    </div>
    <blockquote cite="mid:SNT143-W5030C5CB9AF87F111DD2B8AFDC0@phx.gbl"
      type="cite">
      <style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
      <div dir="ltr">
        Hello,<br>
         <br>
        With Scilab, I know of two ways of converting from a continuous
        time transfer function (e.g. 1/s) to a discrete time transfer
        funtion:<br>
        <span style="color: rgb(0, 0, 0);"></span> <br>
        <span style="color: rgb(0, 0, 0);">1st way:</span><br>
        <span style="color: rgb(0, 0, 0);">s</span><span style="color:
          rgb(92, 92, 92);">=</span><span style="color: rgb(50, 185,
          185);">poly</span><span style="color: rgb(74, 85, 219);">(</span><span
          style="color: rgb(188, 143, 143);">0</span><span style="color:
          rgb(0, 0, 0);">,</span><span style="color: rgb(188, 143,
          143);">'</span><span style="color: rgb(188, 143, 143);">s</span><span
          style="color: rgb(188, 143, 143);">'</span><span style="color:
          rgb(74, 85, 219);">)</span><br>
        <span style="color: rgb(174, 92, 176); text-decoration:
          underline;">ss2tf</span><span style="color: rgb(74, 85, 219);">(</span><span
          style="color: rgb(174, 92, 176); text-decoration: underline;">cls2dls</span><span
          style="color: rgb(74, 85, 219);">(</span><span style="color:
          rgb(174, 92, 176); text-decoration: underline;">tf2ss</span><span
          style="color: rgb(74, 85, 219);">(</span><span style="color:
          rgb(174, 92, 176); text-decoration: underline;">syslin</span><span
          style="color: rgb(74, 85, 219);">(</span><span style="color:
          rgb(188, 143, 143);">'</span><span style="color: rgb(188, 143,
          143);">c</span><span style="color: rgb(188, 143, 143);">'</span><span
          style="color: rgb(0, 0, 0);">,</span><span style="color:
          rgb(188, 143, 143);">1</span><span style="color: rgb(92, 92,
          92);">/</span><span style="color: rgb(0, 0, 0);">s</span><span
          style="color: rgb(74, 85, 219);">)</span><span style="color:
          rgb(74, 85, 219);">)</span><span style="color: rgb(0, 0, 0);">,</span><span
          style="color: rgb(188, 143, 143);">0.1</span><span
          style="color: rgb(74, 85, 219);">)</span><span style="color:
          rgb(74, 85, 219);">)</span>
        <br>
         <br>
        This way requires a lot of typing.<br>
        <span style="color: rgb(0, 0, 0);"></span> <br>
        <span style="color: rgb(0, 0, 0);">2nd Way:</span><br>
        <span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0,
            0);">s</span><span style="color: rgb(92, 92, 92);">=</span><span
            style="color: rgb(50, 185, 185);">poly</span><span
            style="color: rgb(74, 85, 219);">(</span><span style="color:
            rgb(188, 143, 143);">0</span><span style="color: rgb(0, 0,
            0);">,</span><span style="color: rgb(188, 143, 143);">'</span><span
            style="color: rgb(188, 143, 143);">s</span><span
            style="color: rgb(188, 143, 143);">'</span><span
            style="color: rgb(74, 85, 219);">)</span><span style="color:
            rgb(0, 0, 0);">;</span><span style="color: rgb(0, 0, 0);">z</span><span
            style="color: rgb(92, 92, 92);">=</span><span style="color:
            rgb(50, 185, 185);">poly</span><span style="color: rgb(74,
            85, 219);">(</span><span style="color: rgb(188, 143, 143);">0</span><span
            style="color: rgb(0, 0, 0);">,</span><span style="color:
            rgb(188, 143, 143);">'</span><span style="color: rgb(188,
            143, 143);">z</span><span style="color: rgb(188, 143, 143);">'</span><span
            style="color: rgb(74, 85, 219);">)</span><span style="color:
            rgb(0, 0, 0);">;</span></span><br>
        <span style="color: rgb(0, 0, 0);">sl</span><span style="color:
          rgb(92, 92, 92);">=</span><span style="color: rgb(174, 92,
          176); text-decoration: underline;">syslin</span><span
          style="color: rgb(74, 85, 219);">(</span><span style="color:
          rgb(188, 143, 143);">'</span><span style="color: rgb(188, 143,
          143);">c</span><span style="color: rgb(188, 143, 143);">'</span><span
          style="color: rgb(0, 0, 0);">,</span><span style="color:
          rgb(188, 143, 143);">1</span><span style="color: rgb(92, 92,
          92);">/</span><span style="color: rgb(0, 0, 0);">s</span><span
          style="color: rgb(74, 85, 219);">)</span><span style="color:
          rgb(0, 0, 0);">;</span>
        <span style="color: rgb(0, 0, 0);"></span><br>
        <span style="color: rgb(0, 0, 0);">sl2</span><span style="color:
          rgb(92, 92, 92);">=</span><span style="color: rgb(174, 92,
          176); text-decoration: underline;">horner</span><span
          style="color: rgb(74, 85, 219);">(</span><span style="color:
          rgb(0, 0, 0);">sl</span><span style="color: rgb(0, 0, 0);">,</span><span
          style="color: rgb(74, 85, 219);">(</span><span style="color:
          rgb(188, 143, 143);">2</span><span style="color: rgb(92, 92,
          92);">/</span><span style="color: rgb(188, 143, 143);">0.1</span><span
          style="color: rgb(74, 85, 219);">)</span><span style="color:
          rgb(92, 92, 92);">*</span><span style="color: rgb(74, 85,
          219);">(</span><span style="color: rgb(0, 0, 0);">z</span><span
          style="color: rgb(92, 92, 92);">-</span><span style="color:
          rgb(188, 143, 143);">1</span><span style="color: rgb(74, 85,
          219);">)</span><span style="color: rgb(92, 92, 92);">/</span><span
          style="color: rgb(74, 85, 219);">(</span><span style="color:
          rgb(0, 0, 0);">z</span><span style="color: rgb(92, 92, 92);">+</span><span
          style="color: rgb(188, 143, 143);">1</span><span style="color:
          rgb(74, 85, 219);">)</span><span style="color: rgb(74, 85,
          219);">)</span><br>
         <br>
        This way requires me to remember the tustin approximation.<br>
         <br>
        Does matlab have anything like Matlab's c2d function?<br>
        <br>
        Stephen<br>
      </div>
    </blockquote>
    Hi<br>
    <br>
    Did you try defining it yourself?<br>
    <br>
    function y=c2d(x,p)<br>
    <br>
    if argn(2)<2<br>
    p=0.1<br>
    end<br>
    <br>
    <br>
    <span style="color: rgb(174, 92, 176); text-decoration: underline;"> y=
      ss2tf</span><span style="color: rgb(74, 85, 219);">(</span><span
      style="color: rgb(174, 92, 176); text-decoration: underline;">cls2dls</span><span
      style="color: rgb(74, 85, 219);">(</span><span style="color:
      rgb(174, 92, 176); text-decoration: underline;">tf2ss</span><span
      style="color: rgb(74, 85, 219);">(</span><span style="color:
      rgb(174, 92, 176); text-decoration: underline;">syslin</span><span
      style="color: rgb(74, 85, 219);">(</span><span style="color:
      rgb(188, 143, 143);">'</span><span style="color: rgb(188, 143,
      143);">c</span><span style="color: rgb(188, 143, 143);">'</span><span
      style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(188,
      143, 143);">x</span><span style="color: rgb(74, 85, 219);">)</span><span
      style="color: rgb(74, 85, 219);">)</span><span style="color:
      rgb(0, 0, 0);">,</span><span style="color: rgb(188, 143, 143);">p</span><span
      style="color: rgb(74, 85, 219);">)</span><span style="color:
      rgb(74, 85, 219);">)</span>
    <br>
    endfunction<br>
    <br>
    <span style="color: rgb(0, 0, 0);">s</span><span style="color:
      rgb(92, 92, 92);">=</span><span style="color: rgb(50, 185, 185);">poly</span><span
      style="color: rgb(74, 85, 219);">(</span><span style="color:
      rgb(188, 143, 143);">0</span><span style="color: rgb(0, 0, 0);">,</span><span
      style="color: rgb(188, 143, 143);">'</span><span style="color:
      rgb(188, 143, 143);">s</span><span style="color: rgb(188, 143,
      143);">'</span><span style="color: rgb(74, 85, 219);">)</span><br>
    c2d(1/s)<br>
    <br>
    <br>
    you can do similar stuff each time you use something that requires
    lots of typing<br>
    <br>
    BR<br>
    AVS<br>
  </body>
</html>