MATLAB: Spdiags command not working

diagonalmatrix

>> Dx=spdiags([e 2*e e], -1:1, Nx,Nx)/(dx)^{2}
Undefined operator '^' for input arguments of type 'cell'.
What is wrong with this line? cant figure it out.

Best Answer

Remove the curly braces from around the 2 at the end of your statement.