Find the non null complex Fourier coefficients

140 Views Asked by At

I'm doing my homework on signal processing in MatLab and I'm stuck on an exercise.

I'm given this signal $x(t)=1 + 2\sin(12\pi t+\frac{\pi}{4})\cos(21\pi t);$ and I have to get the non null complex Fourier coefficients using this expression $$C_{m}=\frac{1}{T_{0}}\int_{-\frac{T_{0}}{2}}^{\frac{T_{0}}{2}}x(t)e^{-im\omega_{0}t}dt$$

Analytically I've found that $\omega_{0} = 2 rad/s$ so $C_{m} = {2,4}$ and $\Theta_{m} = -\pi,\frac{\pi}{3},\frac{\pi}{4}$

Now I have to do this in MatLab. I've created the following script where I'm calculating the integral but now I'm stuck and don't know what to do next. Can you point me in some direction?

This is my script:

function cfc
    syms m t;
    % Signal
    x1 = 1 + 2*sin(12*pi*t+pi/4)*cos(21*pi*t);

    %T0 and w0 
    T01 = 2*pi/3;
    w01 = 2*pi/T01;

    % Cm
    disp('Cm');
    Cm1 = 1/T01 * int(x1*exp(-1i*m*w01*t),t,-T01/2,T01/2);
    pretty(Cm1);
end
1

There are 1 best solutions below

5
On

Look, it's not clear to me what you are doing analytically. It looks like the problem is asking you to find the values of $m$ for which the Fourier coefficients are nonzero. These correspond to the frequency components of your signal. To see these, you have to use the product relation

$$2 \cos(a) \sin(b) = \sin{(a+b)} - \sin{(a-b)}$$

and then note that $\sin{(x+\pi/4)} = \sqrt{2} (\cos{x} + \sin{x})$. Once you unwrap your signal like this, then you'll immediately have the nonzero Fourier coefficients.