1
votes

I am trying to plot the magnitude and phase representation of a fourier transform.

Here is what I have so far:

syms t w
y(t) = 2*cos(2000*pi*t)*cos(2*pi*(10^6)*t);
x(w) = fourier(y);
h = abs(x);
a = angle(x)
figure, fplot(h)
figure, fplot(a)

But when I plot I just get two straight lines at 0. I understand that the fourier transform returns dirac delta functions. Is there anyway I can plot these functions in matlab?

1

1 Answers

0
votes

Here is a similar example that explicitly defines the vector t:

t = linspace(0,1,82);
y = 2*cos(2000*pi*t).*cos(2*pi*(10^6)*t);
x = fft(y);
h = abs(x);
a = angle(x);

figure, plot(t, x)
figure, plot(t, a)

I have a hunch that your t vector is incremented in a manner that only produces values of "some-integer" multiplied by pi. This will result in values of -1 and 1 being returned from the cos function evaluated in radians.

The code above produces the following:

enter image description here enter image description here