# How to carry values after matlab derivation

### matlab novice seeks advice on how to calculate the derivative value of a definite point using matlab derivatives and substituting values after derivatives

Use diff() to derive the derivative function and eval() to calculate the derivative value.

The specific code is as follows:

The result of the run is:

### Matlab, a function has more than one independent variable, how to find the derivatives and substitute specific values, give an example of f=x1+x2+x3,points

Hello!

I followed the example you gave, simply write a program, for the sake of clarity, the statement is written more simple, you see:

symsx1x2x3

f=x1^2+x2^2+x3^2;

fx1=diff(f,x1);

fx2=diff(f,x2) ;

fx3=diff(f,x3);

subs(fx1, x1, x11)

subs(fx2,x2,x22)

subs(fx3,x3,x33)

The output subs is the result of each partial derivation after the assignment, which you can try running.

diff defaults to derivatives on x, and if there are several x’s, it defaults to derivatives on x1, which defaults to one-medium derivatives.

Good luck~!

### How to assign a value to a function after derivation in matlab

There is a corresponding function: subs(z,’x’,’y’),that is, for the Z function, replace X with Y.

### matlab function derivation variable substitution problem

The substitutions dx1 and dx2 are the results of the derivation calculation above, you can find out by outputting f

> > f % output f

f = (cos(t)^2 + sin(t)^2)^(1/2)

>. > simplify(f) % simplify

ans = 1