1
$\begingroup$

If I have the complex coeffiecients of the Fourier series of a real signal given by

$$s(t)=\sum_{k=-\infty}^{\infty}c_k . e^{jk\omega_0t}$$ How can I plot an aproximation of the signal in MATLAB? I am doing some exercises about Fourier series, but I have no means to check if the coefficients I am finding are corrects.

Thanks

$\endgroup$
1
$\begingroup$

You need to put the signal into real form: $$ f(t) = \sum_{k=-\infty}^\infty a_k\sin(kwt) + b_k\cos(kwt). $$

The integrals for these coefficients are $$ a_k = \int_0^\infty f(t)\sin(kwt)dt \ \ \text{ and } b_k = \int_0^\infty f(t)\cos(kwt)dt $$ so your $c_k$ are $$ c_k = \int_0^\infty f(t) e^{ikwt}dt = a_k + ib_k. $$

MATLAB can easily generate the sine and cosine functions and you can program a function which generates the sinusoids at different frequencies. Then just add the vectors of sines and cosines with multiplied by $a_k$ and $b_k$ respectively. Plotting this versus $t$ with your original function should show that you can increase the fidelity of the reconstruction by adding more terms and prove that your coefficients are correct.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.