MATLAB: How to differentiate several symbolic functions

differentiationsymbolicSymbolic Math Toolbox

I have 3 symbolic functions; L10(a) , L1(u,a) and finally epsilon1(u). I wish to differentiate the last symbolic function (epsilon1) with respect to u, but it only gives me 0 because it does not take into account how I defined L1 and L10 previously which contains u. How can I solve this?
syms L10(a)
L10(a) = 2*a;
syms L1(u,a)
L1(u,a) = sqrt((2*a)^2+u^2);
syms epsilon1(L1,L10)
epsilon1(u) = (L1-L10)/L10;
df = diff(epsilon1(u),u)

Best Answer

syms L10(a) L1(a,u) epsilon1(a,u)
L10(a) = 2*a;
L1(a,u) = sqrt((2*a)^2+u^2);
epsilon1(a,u) = (L1(a,u)-L10(a))/L10(a);
df = diff(epsilon1(a,u),u)