Search code examples
matlabderivativesymbolic-integration

Calculating derivative and integration using matlab


I am trying to find second derivative of a function, but while initializing my symbols i am getting the following error:

Error using ==> subsindex
Function 'subsindex' is not defined for values of class 'sym'.

The commands I am using are:

syms x a b c L;
u = (a*x(x-L))+(b*x((x^2)-(L^2)))+(c*x((x^3)-(L^3)));

"u" is my function.


Solution

  • I don't know much about MATLAB's symbolic capabilities, but that error is coming from the pieces like

    x(x-L)
    

    which MATLAB is interpreting as an indexing operation. Did you mean multiplication there? I.e.

    x*(x-L)