<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt">Hi Anders,<br><br>I ran this script and the plot is the freq response.  it looks like a lowpass filter but not like I am used to it..<br><br>clear <br>clc<br><br>f1 = 0.1;      //Hz<br>tSamp = 0.01;  //s<br>tMax = 200;<br>t = 0:tSamp:tMax;<br>y = sin(2*%pi*f1*t);<br><br>Order = 1;<br>Fcutoff = 0.1;<br>Fs = 1/tSamp;<br>hz = iir(Order,'lp','butt',[Fcutoff/Fs 0],[0 0]);<br>[hzm,fr]=frmag(hz,256);   //<-- 256 points.. you can change this value..<br>plot2d(fr',hzm')<br><br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Anders Sneckenborg
 <anders@simbalsyd.se><br><b><span style="font-weight: bold;">To:</span></b> "users@lists.scilab.org" <users@lists.scilab.org><br><b><span style="font-weight: bold;">Sent:</span></b> Thu, 15 April, 2010 11:50:07<br><b><span style="font-weight: bold;">Subject:</span></b> SV: SV: [scilab-Users] lowpassfilter<br></font><br>Hi Julio<br><br>How do you plot the freq response?<br><br>Regards<br>Anders<br><br>________________________________________<br>Från: Julio Gonzalez-Saenz [<a ymailto="mailto:julio.gonzalez@ymail.com" href="mailto:julio.gonzalez@ymail.com">julio.gonzalez@ymail.com</a>]<br>Skickat: den 15 april 2010 11:31<br>Till: <a ymailto="mailto:users@lists.scilab.org" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>Ämne: Re: SV: [scilab-Users] lowpassfilter<br><br>Hi Anders,<br><br>I you plot the freq response of iir you see that the max value is around 0.75 same as your graphic shows.. I will take a closer look at the
 iir response..<br><br>Regards,<br><br>Julio Gonzalez-Saenz<br>www.part-time-scientists.com<br>www.neex-technologies.com<br><br>________________________________<br>From: Anders Sneckenborg <<a ymailto="mailto:anders@simbalsyd.se" href="mailto:anders@simbalsyd.se">anders@simbalsyd.se</a>><br>To: "<a ymailto="mailto:users@lists.scilab.org" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>" <<a ymailto="mailto:users@lists.scilab.org" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>><br>Sent: Thu, 15 April, 2010 7:14:38<br>Subject: SV: [scilab-Users] lowpassfilter<br><br>Hi again<br><br>I edited the code (removed dead code) and here it is again. It will execute exactly as before but without the disturbing dead code.<br><br>//---------------------------<br>f1 = 0.1;      //Hz<br>tSamp = 0.01;  //s<br>tMax = 200;<br><br>t = 0:tSamp:tMax;<br>y = sin(2*%pi*f1*t);<br><br>Order = 1;<br>Fcutoff =
 0.1;<br>Fs = 1/tSamp;<br>hz = iir(Order,'lp','butt',[Fcutoff/Fs 0],[0 0]);<br>sl = tf2ss(hz);<br>yf = flts(y,sl);<br><br>plot(t,y,'-b');<br>plot(t,yf,'-r');<br>//---------------------------<br><br>/Anders<br><br><br>Från: Julio Gonzalez-Saenz [mailto:<a ymailto="mailto:julio.gonzalez@ymail.com" href="mailto:julio.gonzalez@ymail.com">julio.gonzalez@ymail.com</a>]<br>Skickat: den 14 april 2010 22:42<br>Till: <a ymailto="mailto:users@lists.scilab.org" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>Ämne: Re: [scilab-Users] lowpassfilter<br><br>Hi Anders,<br><br>Can you please double check the semicolon on the function y definition? You also have a f1 and f2 but only f1 is defined..<br><br>Regards,<br><br><br>Julio Gonzalez-Saenz<br>www.part-time-scientists.com<br>www.neex-technologies.com<br><br><br>________________________________<br>From: Anders Sneckenborg <<a ymailto="mailto:anders@simbalsyd.se"
 href="mailto:anders@simbalsyd.se">anders@simbalsyd.se</a>><br>To: "<a ymailto="mailto:users@lists.scilab.org" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>" <<a ymailto="mailto:users@lists.scilab.org" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>><br>Sent: Wed, 14 April, 2010 22:19:29<br>Subject: [scilab-Users] lowpassfilter<br>Hi<br><br>When running the following script I expected the filtered signal to have an amplitude of 0.5.<br>My intention was to lowpassfilter a signal with the same frequency as the cutoff frequency.  Am I doing something wrong?<br><br>//---------------------------<br>f1 = 0.1;      //Hz<br>tSamp = 0.01;  //s<br>tMax = 200;<br><br>t = 0:tSamp:tMax;<br>y = 1*sin(2*%pi*f1*t);  + 0.5*sin(2*%pi*f2*t);<br><br>Order = 1;<br>Fcutoff = 0.1;<br>Fs = 1/tSamp;<br>hz = iir(Order,'lp','butt',[Fcutoff/Fs 0],[0 0]);<br>sl = tf2ss(hz);<br>yf =
 flts(y,sl);<br><br>plot(t,y,'-b');<br>plot(t,yf,'-r');<br>//---------------------------<br><br>Best regards<br>Anders<br><br>  I<br><br></div></div>
</div><br>



      </body></html>