Be the first to rate this file! 5 Downloads (last 30 days) File Size: 6.71 KB File ID: #12508

Sum of harmonics

by Gabriele

 

03 Oct 2006 (Updated 12 Oct 2006)

Sum of harmonic components through FORTRAN MEX file

| Watch this File

File Information
Description

For several different reasons it could occur that we need to produce a signal from the sum of several harmonic components. In the usual case of Fourier analysis, FFT and IFFT are likely the best choice. However it could happen that:
- The frequencies of the harmonic components are unevenly spaced
- The time vector is unevenly spaced
In such cases we could be in the need of coding the summation directly in Matlab, that is quite slow in performing this tasks.
The provided function is simply a MEX file that performs the signal generation through a compiled FORTRAN code.
Nothing special, but at least I run the generation almost three times faster than in Matlab. Not as good as in the cases where you can use IFFT directly in Matlab, but at least a little bit better than using a "for" loop directly in Matlab.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
12 Oct 2006

Better explanation of the fact that the speed is increased with respect to the standard for loop in matlab

Tag Activity for this File
Tag Applied By Date/Time
dsp Gabriele 22 Oct 2008 08:42:19
harmonic fourier gaussian spectrum unevenly phase Gabriele 22 Oct 2008 08:42:19

Contact us at files@mathworks.com