[Scilab-users] bug in function iir ?

Serge Steer Serge.Steer at inria.fr
Fri Feb 26 10:03:10 CET 2016


Le 25/02/2016 18:10, grivet a écrit :
> Le 24/02/2016 21:40, Serge Steer a écrit :
>> Le 24/02/2016 11:30, grivet a écrit :
>>> I appreciate your help; however, neither suggestion works: I still 
>>> get the same error message.
>>> The similar line
>>>         [frq,repf]=repfreq(hz,0.01,0.49);
>>> has no problem
You are right the problem is exactly for the frequency 0.5 besause
exp(2*%pi*%i*0.5) -> - 1. + 1.225D-16i
and hz.num has 2 zeros  very near  -1

I checked the hz value with Matlab, the results are the same. So it 
seems that hz is ok. So it is probabily a probleme due to floating point 
computations procucing a zero value instead of a very small one.

Serge
>> please can you save the hz value using the Scilab save function and 
>> send the file?
>> Serge
>>>>
> Voila le code:
> //filtre Butterworth
> Order   = 2; // The order of the filter
> Fs      = 1000; // The sampling frequency
> Fcutoff = 40;   // The cutoff frequency
>
> // We design a low pass Butterworth filter
> hz = iir(Order,'lp','butt',Fcutoff/Fs/2,[0.1 0.1]);
>
> // We compute the frequency response of the filter
> [frq,repf]=repfreq(hz,0,0.5);
> [db_repf, phi_repf] = dbphi(repf);
>
> // And plot the bode like representation of the digital filter
> subplot(2,1,1);
> plot2d(Fs*frq,db_repf);
> xtitle('Obtained Frequency Response (Magnitude)');
> subplot(2,1,2);
> plot2d(Fs*frq,phi_repf);
> xtitle('Obtained Frequency Response (Phase in degree)');
>
> iir est sauvegardé dans "svgd_iir" joint (binaire).
>
> Cordialement,
> JP Grivet
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160226/9e50fffb/attachment.htm>


More information about the users mailing list