Tuesday, October 27, 2009

Response in frequency

Hi Cek, I saw your comment (here), and I'd like to say that I never worked with these functions before. But we can learn about the functions.

Let's start with the freq(.) function.

This code is the example in Scilab's help.

s = poly(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]);
[horner(sys, 0), horner(sys, 20)]
Sys = tf2ss(sys);
[A, B, C, D] = abcd(Sys);
freq(A, B, C, [0, 0.9, 1.1, 2, 3, 10, 20])

In the code, we see the function freq(.) is used with polynomials (in the Space of Laplace). The last argument (the vector [0, 0.9, 1.1, 2, 3, 10, 20]) represents the calculated frequencies for the polynomial sys.

The function tf2ss(.) means time/frequency to state-space.

The function refreq(.) does the same things of the function freq(.), but it uses other arguments.

Look the function's description, in Scilab's help.

[ [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])


sys: syslin list : SIMO linear system
fmin, fmax: two real numbers (lower and upper frequency bounds)
frq: real vector of frequencies (Hz)
step: logarithmic discretization step
splitf: vector of indexes of critical frequencies.
repf: vector of the complex frequency response

The function horner(.) evaluates a polynomial in a specific point, for example:

s = poly(0,'s');
M = [s, 1/s]; // M is the polynomial in analysis
x1 = horner(M,1)
x1 =

1. 1.

x2 = horner(M,%i)
x2 =

i - i

x3 = horner(M,1/s)
x3 =

1 s
- -
s 1

If you want, then we can try to learn anything about the others functions: bode, syslin and csim.

1 comment:

123 said...

It was very interesting for me to read this post. Thanx for it. I like such themes and anything connected to this matter. I would like to read more on that blog soon.
Phone jammer