Rhinocerotidae
Rhinocerotidae

Reputation: 925

Matlab - derivative of a function expression

I have the following non-linear equation

enter image description here

Where A1, B1, C1, D1, E1, A2, B2, C2, D2, E2 are some constants. However, Z is some function of eta(z = z(eta)).

Is it possible, in Matlab, to get an expression for the (first and second)derivative of the above equation with respect to eta i.e dz/d-eta and d^2z/d-eta^2?

I have tried diff(aboveexpression,eta) . But this treats z as constant.

How do I tackle this?

Upvotes: 0

Views: 145

Answers (1)

AVK
AVK

Reputation: 2149

Yes, it is possible (and it is possible without determining the analytical expression for z). You can use the inverse function differentiation rule:

syms A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 z
F= A1*atan(B1*asinh(C1*z-D1)+E1)+A2*atan(B2*asinh(C2*z-D2)+E2);
dz= 1/diff(F,z) % the first derivative

Now the second derivative. We need to differentiate the resulting expression dz, where z is a function of eta. We can use the fact that

d2z= diff(dz,z)*dz  % the second derivative

Upvotes: 1

Related Questions