MATLAB failed to compute the fft
of this function:
syms t;
x= 1/(1+t^2);
X= fft(x)
And threw this error:
Undefined function 'fft' for input arguments of type 'sym'.
Why didn't it take the Fourier transform of the symbolic variable? I think it should because we may want to obtain the result as a symbolic value.
I also tried to solve the problem with non-symbolic variable.
t= -10:0.01:10;
x= zeros(2001);
x= 1/(1+t.^2);
fft(x)
this time my error is:
Matrix dimensions must agree.
However, they have the same dimensions. Where is my fault?
The documantation on
fft
says:Symbolic functions are continuous, not discrete. Hence, the algorithm fails.
With regards to your second question: use element-wise operators, by adding a dot:
MATLAB complains about matrix dimensions, because you are trying to divide a scalar (i.e. a
1 x 1
matrix) by a vector of length 2001. element-wise division solves that problem.