<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Dear Scilabers</p>
<p>I have calculated an impulse response and wish to do an FFT to
achieve the frequency response. I know what to expect. In the
matlab forum someone asked the same question and was recommended
to use freqz ... I wonder what would be the equivalent function in
Scilab?</p>
<span style="color:rgb(0,0,0);">https</span><span
style="color:rgb(255,170,0);">:</span><span
style="color:rgb(100,174,100);font-style:italic;">//www.mathworks.com/matlabcentral/answers/350350-how-to-plot-loudspeaker-frequency-response-from-its-impulse-response</span>
<p>For example, to replicate the code snippet (second answer in
above link), how to do this in Scilab?</p>
<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(100,174,100);font-style:italic;">// impulse
response</span> (Matlab source code)<br>
<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><br>
<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><br>
<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><br>
<span style="color:rgb(0,0,0);">semilogx</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);">mag2db</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(50,185,185);">abs</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(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);">grid</span> <span
style="color:rgb(0,0,0);">on</span><span style="color:rgb(0,0,0);">;</span><br>
<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>
<p>Best regards,</p>
<p>Claus<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>