I was doing some basic problems in Fourier transform and using MATLAB to verify my answers. I encountered a problem when I tried to find the Fourier transform expression of the following two signals:
y1 = 2*exp(-t)u[t] + 5*exp(-(t-1)/2)u[t-1]
y3 = cos(2*t)/(4+t^2)
I usually use the fourier
function, which works fine for some signals, but here the result is quite unhelpful:
>> fourier(y3,f)
ans =
fourier(cos(2*t)/(t^2 + 4), t, f)
The correct answer should be a shifted frequency exponential.
How can I get the desired expression?
My full code:
syms t f;
disp('Fourier transform of y1 = 2*exp(-t)u[t] + 5*exp(-(t-1)/2)u[t-1] is ');
y1 = (t>=0).*2*exp(-t) + (t>=1).*5*exp(-(t-1)/2);
Y1 = fourier(y1,f);
pretty(Y1)
disp('Fourier transform of y3 = cos(2*t)/(4+t^2) is ');
y3 = cos(2*t)/(4+t^2);
Y3 = simplify(fourier(y3,f));
pretty(Y3)