Search code examples
matlabsymbolic-math

Symbolic function without body matlab


Is it possible to declare a symbolic function in terms of two other variables without specifying the function body in MATLAB?

I want to have a function $\theta(x,t)$ where $x,t$ are variables. Just declaring $theta$ as a variable makes it $0$ when I take the partial derivatives with respect to $x$ or $y$.


Solution

  • syms f(x)
    diff(f,x)
    

    returns

    ans(x) =
     
    diff(f(x), x)