<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi Tan, et al.<br>
      <br>
      Thank you for the complete response to my initial request.<br>
      <br>
      This is very helpful for me to understand ... but if this is
      indeed the equivalent of the matlab script, I wonder about if the
      help I found in the matlab forum is helpful or not. The reason I'm
      still wondering is because the matlab forum question is exactly
      like mine - I wish to find the fft of a loudspeaker impulse
      response and I expect a loudspeaker frequency response with
      roll-off at low frequencies, but now that I see the result of the
      below script with random data for the impulse response ... I see
      that the generated output is a "filter" - which is not at all what
      I expected and I think the similar response in the matlab forum
      was also not helpful (I do not have access to matlab / cannot test
      and or verify). Sorry for this. The entire concept may not be
      useful in my case, but Scilab supports advanced FFT routines
      (FFTW) and it should be possible to do what I need.<br>
      <br>
      Rafael is right that the previously attached stepresponse script
      explains in detail my situation. If I take the "H" vector (the
      impulse response) in the script and apply a basic fft(H), it looks
      like this:<br>
      <br>
      Added script code:<br>
      <pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(0,0,0);">Resp</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">fft</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">H</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(74,85,219);">[</span><span style="color:rgb(0,0,0);">db</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">phi</span><span style="color:rgb(74,85,219);">]</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">dbphi</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">Resp</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// convert frequency response into magnitude and phase</span>
<span style="color:rgb(0,0,0);">f_max</span> <span style="color:rgb(92,92,92);">=</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);">tau_step</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// Hz</span>
<span style="color:rgb(0,0,0);">f</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">f_max</span> <span style="color:rgb(92,92,92);">*</span> <span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">0</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(50,185,185);">length</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">H</span><span style="color:rgb(74,85,219);">)</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(50,185,185);">length</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">H</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">//associated frequency vector</span>
<span style="color:rgb(0,0,0);">scf</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(0,0,0);">plot</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">f</span><span style="color:rgb(92,92,92);">'</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(0,0,0);">nt</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">db</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(0,0,0);">nt</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(188,143,143);">2</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(100,174,100);font-style:italic;">// Transpose X to prevent WARNING</span>
<span style="color:rgb(0,0,0);">re</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">gca</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(0,0,0);">re</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">log_flags</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">lnn</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">xgrid</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">color</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">grey70</span><span style="color:rgb(188,143,143);">"</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(0,0,0);">xlabel</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Frequency (Hz)</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);">ylabel</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Magnitude (dB)</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);"></span></pre>
      RESULT :<br>
      <img src="cid:part1.AF13493D.E56AFB95@gmail.com" alt=""><br>
      This is not exactly what I had in mind, the "shape" of the curve
      isn't right, but then again - there are some inner-workings I
      don't know about (like, is the dbphi function doing what I think
      it does?). Maybe I cannot use dbphi(), or maybe I just have an
      error somewhere in the calculation of the impulse response. I
      expected a level of approx. 86 dB with a roll-off towards the
      lower frequencies. Here's the expected response (from simulation
      based on the input response function, i.e. not based on impulse
      response and not by fft):<br>
      <br>
      <img src="cid:part2.108CE5B3.D4B4F665@gmail.com" alt=""><br>
      <br>
      Best regards,<br>
      Claus<br>
      <br>
      On 18.09.2018 04:25, Tan Chin Luh wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:408ac287-70bb-9c8c-daf1-e7238a69b575@tritytech.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div class="moz-cite-prefix">On 18/9/2018 5:15 AM, Rafael Guerra
        wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:VI1PR04MB41097F4F5B81A99DEA06965ACC1E0@VI1PR04MB4109.eurprd04.prod.outlook.com">
        <pre wrap="">Chin Luh:  good to know but how does that solve Claus Futtrup specific problem?
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>

</pre>
      </blockquote>
      <p>just notice that the answer similar as the one Tim provided,
        just a bit confused on Claus' comment on the "random" data:</p>
      <div class="moz-cite-prefix">On 17/9/2018 1:13 AM, Claus Futtrup
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:6485d137-6e1b-65fe-11f3-6521a604d3ef@gmail.com">What I
        like about the Matlab example is that random data is generated
        to represent the impulse response, so this represents "any data"
        ... I need that. If Scilab cannot do it, it's OK. </blockquote>
      <p>Do you refer this "random" data to the example provided?</p>
      <pre class="language-matlab" style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; display: block; padding: 9.5px; margin: 0px 0px 21px; line-height: 1.42857; color: rgb(51, 51, 51); word-break: normal; overflow-wrap: normal; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">h = rand(1,64); % impulse response <-- This?
<span style="color:rgb(0,0,0);">fs</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">1000</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">Nfft</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">128</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(74,85,219);">[</span><span style="color:rgb(0,0,0);">H</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">F</span><span style="color:rgb(74,85,219);">]</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">freqz</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">h</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">Nfft</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">fs</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">plot</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">F</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">H</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(0,0,0);">grid</span> <span style="color:rgb(0,0,0);">on</span><span style="color:rgb(0,0,0);">;</span></pre>
      <p>If so, the equivalent scilab code would be as below:</p>
      <pre style="font-family:Monospaced;font-style:normal;font-size:16.0;"><span style="color:rgb(0,0,0);">h</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">rand</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">64</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">fs</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">1000</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">b</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(0,0,0);">h</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(255,170,0);">$</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</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(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">coeff</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);">a</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(218,112,214);">%z</span><span style="color:rgb(92,92,92);">^</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">length</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">h</span><span style="color:rgb(74,85,219);">)</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(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">Gz</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);">d</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">b</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">a</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">Gz</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">dt</span> <span style="color:rgb(92,92,92);">=</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);">fs</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(74,85,219);">[</span><span style="color:rgb(0,0,0);">F</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">H</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(174,92,176);text-decoration:underline;">repfreq</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">Gz</span><span style="color:rgb(0,0,0);">,</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);">500</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">0.01</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">plot</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">F</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">H</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;

Do note that I replace the last part of semilogx plot and replace with plot for more simple codes. 
</span></pre>
      <pre class="moz-signature" cols="72">-- 
Tan Chin Luh
Trity Technologies Sdn Bhd
Tel : +603 80637737
HP : +6013 3691728
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <p><br>
    </p>
  <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
        <tr>
        <td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
                <td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
                </td>
        </tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>