swept_sine
Common swept sine (or cosine) generation functions use a linear time vector with an increasing frequency rate. This results in the higher frequency content range having fewer points per cycle which reduces the quality of the swept sine at higher frequencies. The most common solution to this problem is to make the time increment smaller thus increasing the number of points in the higher frequency content at the expense of a significant increases in vector size and numerical computation time.
A second and less common solution is to use an exponential time increment to place more of the time increment points in the higher frequency domain where they are needed. However, these methods are not trivial to define and usually result in inconsistent numbers of points per cycle. Non-linear time methods need to have the time increment rate matched with the frequency range AND the number of cycles contained in the sine function to produce a progressive increase in the frequency rate and maintain a consistent number of point on the curve per cycle.
The following swept sine function avoids the compromises of the above solutions by generating a constant sine function and a swept time function. The result is a swept sine function that contains a consistent number of points per cycle, has a linear sweep rate, and permits the user to define the total number of cycles in the signal. The inputs to the model are the initial and final frequencies, the number of cycles in the sweep function, and the number of points per cycle.
The attached image shows the swept sine function (top), the more typical Chirp function in the middle, and a typical exponential time plot at the bottom. All were evaluated over 0.1 to 10 Hz. Note that the signal content of the swept sine function is significantly better at higher frequencies and that the swept_sine function contains fewer points in the lower frequencies where the fidelity requirements are lower.
Cite As
michael arant (2024). swept_sine (https://www.mathworks.com/matlabcentral/fileexchange/24987-swept_sine), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.