# MATLAB - Fourier (how do I do this)

1. Mar 25, 2007

I would like to use Matlab to check my answers.

For example, I want to find the Fourier transform of $$\cos \omega_0 t$$.

$$\pi ( \delta(\omega - \omega_0) + \delta(\omega + \omega_0))$$.

How do I do this in Matlab. All I can find is something like this:
Code (Text):

clc;
syms t;
fourier(cos(t))

This returns:
Code (Text):
pi*(dirac(w-1)+dirac(w+1))
I would really like to be able to do something like:
Code (Text):

clc;
syms t;
fourier(cos(a*t))

and get:
Code (Text):
pi*(dirac(w-a)+dirac(w+a))
so I can actually check harder transforms.

How would I do this?

2. Jul 21, 2010

### Sean Ehle

Just make sure that "a" is also initialized in your symbolic variables.

>> syms a t
>> fourier(cos(t))

ans =

pi*(dirac(w - 1) + dirac(w + 1))

>> fourier(cos(a*t))

ans =

pi*(dirac(a + w) + dirac(a - w))