I would suggest using the ffts that are built in to matlab.
Mat lab code for series expansion of the complex exponential.
You can use the.
Series expansion of exponential and logarithmic functions.
Syms x t1 taylor exp x t2 taylor sin x t3 taylor cos x t1 x 5 120 x 4 24 x 3 6 x 2 2 x 1 t2 x 5 120 x 3 6 x t3 x 4 24 x 2 2 1.
For real values of x in the interval inf inf y is in the interval 0 inf for complex values of x y is complex.
Exponential values returned as a scalar vector matrix or multidimensional array.
The data type of y is the same as that of x.
We will assume it has an odd periodic extension and thus is representable by a fourier sine series f 1 sin n n l n x f x b s sin 1.
For real values of x in the interval inf inf y is in the interval 0 inf for complex values of x y is complex.
You might be undersampling them so make sure your minimum step size is smaller than the period of the function by at least factor 10.
Graphing a complex exponential.
In mathematics the gamma function represented by the capital letter gamma from the greek alphabet is one commonly used extension of the factorial function to complex numbers the gamma function is defined for all complex numbers except the non positive integers.
Series expansions of exponential and some logarithms functions.
Exponential values returned as a scalar vector matrix or multidimensional array.
To troubleshoot your code i would plot the functions you are using and investigate how the quad function samples them.
Where a 0 models a constant intercept term in the data and is associated with the i 0 cosine term w is the fundamental frequency of the signal n is the number of terms harmonics in the series and 1 n 8.
Fit fourier models interactively.
Find the maclaurin series expansions of the exponential sine and cosine functions up to the fifth order.
Fourier series example matlab evaluation square wave example consider the following square wave function defined by the relation 1 0 5 1 1 0 5 x x f x this function is shown below.
The data type of y is the same as that of x.
Learn more about complex exponential functions mathematics.
For any positive integer.