I couldn't find anything related to functionalDerivative
on StackExchange, but I apologise if this is a duplicate of another question.
Suppose I have a function $f(y)$, where $y$ is itself a function of $x$. Using MATLAB, I'd like to find $g(x)$, where $g=\frac{∂f}{∂y}$ as a function of $x$.
Here's my code, which returns an error:
syms y(x)
f = 2*y^2;
y = x+3;
g = functionalDerivative(f,y)
If I instead define $y$ after calculating $g$, I obtain $g(y)$ instead of $g(x)$:
syms y(x)
f = 2*y^2;
g = functionalDerivative(f,y);
y = x+3;
simplify(g)
I'm pretty new to MATLAB, so maybe I'm missing something really simple.
Thanks for any help.