Hi Samuel and Scilabers
My problem with freq and repfreq is that they require a "sys" input,
which implies I need to describe a response function of some sort. For
example (from the Scilab web-help):
https://help.scilab.org/docs/6.0.1/en_US/freq.html (example code)
s=poly <https://help.scilab.org/docs/6.0.1/en_US/poly.html>(0,'s');
sys=(s+1)/(s^3-5*s+4)
rep=freq(sys("num"),sys("den"),[0,0.9,1.1,2,3,10,20])
https://help.scilab.org/docs/6.0.1/en_US/repfreq.html (syntax)
[ [frq,] repf]=repfreq(sys,fmin,fmax[,step])
[ [frq,] repf]=repfreq(sys[,frq])
[ frq,repf,splitf]=repfreq(sys,fmin,fmax[,step])
[ frq,repf,splitf]=repfreq(sys[,frq])
... So, the thing with the matlab freqz (as the example repeated below
shows) is just a basic FFT with sampling, etc:
h = rand(1,64); // impulse response (Matlab source code)
fs = 1000;
Nfft = 128;
[H,F] = freqz(h,1,Nfft,fs);
semilogx(F,mag2db(abs(H))); grid on;
xlabel('Frequency (Hz)'); ylabel('Magnitude (dB)');
It may very well be that I just don't understand the help page of
repfreq. For example it says about sys: "A siso or simo linear dynamical
system, in state space, transfer function or zpk representations, in
continuous or discrete time." - al right then, it seems pretty capable,
but so, what's "zpk" for example? ... my apologies for finding the
Scilab help to be cryptic and the examples insufficient for me to solve
my problem, hence I ask if someone can take above matlab code and make
it work in Scilab.
Best regards,
Claus
On 15.09.2018 00:32, Samuel Gougeon wrote:
Le 14/09/2018 à 20:57, Claus Futtrup a écrit :
Dear Scilabers
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?
https://www.mathworks.com/matlabcentral/answers/350350-how-to-plot-loudspeaker-frequency-response-from-its-impulse-response
For example, to replicate the code snippet (second answer in above
link), how to do this in Scilab?
h = rand(1,64); // impulse response (Matlab source code)
fs = 1000;
Nfft = 128;
[H,F] = freqz(h,1,Nfft,fs);
Did you have a look around freq() or repfreq()?
We have somewhat the equivalence invfreqz(H,F,m,n,W) <=>
frfit(F*2*%pi, H, n, W) // Scilab
So you may look for the reciprocal of Scilab's frfit()
HTH
Samuel
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users