# Am i performing Sinesweep correctly?

I am bit unsure whether i am doing i sine sweep correctly. I am feeding my system a sine wave with f hertz within a given time interval and log its output.

And then i do the same for another frequency.

I tried this technique but seem to do it incorrect or so i think. I tested for 2 frequencies, and fed them into Ident in matlab and got a fit rate of 98 % which makes no sense that it could build a such a good bode plot based on 2 values..

I am doing something wrong.. should it not have more than one 2 input or is it enough?

The theory behind sweep-sine measurements of LTI systems requires a signal with constantly changing the frequency. You cannot simply playback few tones - the whole frequency range is necessary.

So that if you want to identify your system with the impulse response $h[n]$, you feed the sweep sine signal $s[n]$ into it and record the output. Obviously output will be given by the convolution:

$$y[n]=h[n]\star s[n]$$

In order to obtain the impulse response of the system, it is required to convolve the output $y[n]$ with the inverse filter $f[n]$. Generally, the inverse filter is a sweep signal, inverted in time and with scaled amplitude. So in the end:

$$h[n]=y[n]\star f[n]$$

There are two major types of sweep signals: linear and logarithmic (exponential) frequency change. The latter one is more commonly used, since its spectrum is similar to a pink noise. Personally I always use the logarithmic sweep sine:

$$s(t) = \sin\left[ \dfrac{2\pi f_1 T}{\ln\left( \dfrac{2\pi f_2}{2\pi f_1} \right)}\left(e^{\dfrac{t}{T}\ln\left(\dfrac{2 \pi f_2}{2\pi f_1} \right)} -1\right) \right]$$

where:

$f_1$,$f_2$ - initial and final frequency of a sweep

$T$ - sweep duration in seconds

There is no strict rule on what should be the length of a sweep. For example in acoustics, the rule of thumb is that it should be at least as long as predicted reverberation time.

For more literature on the topic, please refer to the following sources:

• Thank you very much +1000. You should not know how matlab incorporates these methods.. I tried creating a dataset but wasn't able to make one.. It just returns a single value – sasd May 21 '15 at 22:08
• do you have any literature on the other methods aswell – sasd May 21 '15 at 22:11
• A. Farina provided some source code for that. It's easy to find in his papers. Which bit is unclear to code? – jojek May 21 '15 at 22:11
• I tried the chirp function which matlab provide but cannot seem to get a data set out.. It seem to just output one value – sasd May 21 '15 at 22:39
• Don't use the MATLAB chirp function - it is crap. Write your own code that you do understand. I provided you with the equation and you can use it easily. Here you get an example. – jojek May 22 '15 at 8:01

A sine sweep usually goes over the entire frequency range of interest. For example with audio you may have a sweep of 20 Hz to 20 kHz (or 16 kHz). All of the frequencies will be swept through in one continuous output. You can do this by generating the samples with sin(2*pi*n*f/fs) with f incremented every arbitrary number of samples n.

• Hmm.. why can i not do it like this.. how long time shall i do it.. and since i analyze in time domain isn't it a time domain analysis rather frequency domain.. Could you provide som literature on why this form for test is better rather than normal impulse,step and so on.. – sasd May 21 '15 at 20:19