MATLAB: Fourier transformed signal doesn’t show up in ezplot

ezplotfourier

here is the code im working with
clear;
syms x(t) X(w)
f1 = 2;
f2 = 3;
x(t) =cos(2*pi*f1*t) + sin(2*pi*f2*t);
X(w)=fourier(x(t))
ezplot(X(w));
and yet here is what it looks like
and using fft on x(t) only brings up "Invalid data type. First argument must be double, single, int8, uint8, int16, uint16, int32, uint32, or logical." how do i fix this

Best Answer

t=0:0.1:1000;
f1 = 2;
f2 = 3;
x =cos(2*pi*f1.*t) + sin(2*pi*f2.*t);
X=abs(fft(x))/numel(t);
plot(t,X);