imat_fn/sweep (+Modal)


Purpose

Generate a sweep function.

Syntax

g=sweep(10,.001,1000)
g=sweep([10 20],.001,'time',5.0)
g=sweep([10 20],1/1000,ftemplate,'cos','log')
g=sweep(freq,damp,npts,ftemplate,type,spacing)

Description

SWEEP generates a sine, cosine, or square wave sweep, based on the specified inputs. It returns the output in the imat_fn F.

Three input arguments are required. FREQ is a 1x2 vector or a scalar specifying the frequency range over which to sweep. DELTAT is a scalar giving the time spacing between points. NPTS is a scalar specifying the number of data points to create. An alternate specification method is to pass in the string 'time' followed by a number containing the duration (in seconds) of the sweep. SWEEP will calculate the number of points that most closely achieves this end time based on the provided DELTAT.

FTEMPLATE is a required imat_fn input that provides a template function in which to place the sweep function. It is required so that MATLAB can find this function. You can use this to pre-specify attributes in the output function. If you don't have a template function, simply pass in an empty imat_fn.

TYPE is a string specifying the type of sweep function you wish to create. Valid options are 'sin', 'cos', and 'square'. The default is 'sin'.

SPACING is a string specifying the sweep type.  Valid options are 'lin' for a linear sweep and 'log' for a logarithmic sweep. The default is 'lin'.

NOTE: Care should be taken when specifying a different start and end frequency. You may want to sweep a slightly wider frequency range if you are concerned about the energy content in the frequency band of interest. It is a good idea to review a FFT of your sweep time history.

See Also

imat_fn/fft