# How can i determine the analytical expression of the derived funtion "df(x)/dx" ?

7 vues (au cours des 30 derniers jours)
Mallouli Marwa le 23 Jan 2017
Commenté : Star Strider le 23 Jan 2017
How can i determine the analytical expression of the derived funtion "df(x)/dx"?
x=linspace (0:40)
L=3;
sol(1)=2;
psi=1;
f (x) = @(x) cos ( (sol(1)/L) *x)- cosh( (sol(1)/L) *x)+ psi *( sin( (sol(1)/L) *x)- sinh( (sol(1))
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

Star Strider le 23 Jan 2017
Use the Symbolic Math Toolbox:
syms x
L=sym(3);
sol(1)=sym(2);
psi=sym(1);
f (x) = cos ( (sol(1)/L) *x)- cosh( (sol(1)/L) *x)+ psi *( sin( (sol(1)/L) *x)- sinh( (sol(1))));
df_dx = diff(f,x)
df_dx_fcn = matlabFunction(df_dx)
df_dx(x) =
(2*cos((2*x)/3))/3 - (2*sin((2*x)/3))/3 - (2*sinh((2*x)/3))/3
df_dx_fcn = @(x) cos(x.*(2.0./3.0)).*(2.0./3.0)-sin(x.*(2.0./3.0)).*(2.0./3.0)-sinh(x.*(2.0./3.0)).*(2.0./3.0)
##### 2 commentairesAfficher AucuneMasquer Aucune
Mallouli Marwa le 23 Jan 2017
If i want to comput the derived function in a point y=40 "df_dy(40)"
I obtain this error
Error in MuPAD command: Index exceeds matrix dimensions.
Star Strider le 23 Jan 2017
I am not certain how you called the function, that is named ‘df_dx’, not ‘df_dy’. You can always rename it in the derivation and assignment, but you have to use the function name that exists. (I do not know if you used double quotes in your code. The double quotes (") are not valid MATLAB syntax.)
Depending on what you want, one of these will work:
y = 40;
SymOutput = df_dx(y)
SymOutput = vpa(df_dx(y))
NumOutput = df_dx_fcn(y)
SymOutput =
(2*cos(80/3))/3 - (2*sin(80/3))/3 - (2*sinh(80/3))/3
SymOutput =
-127076407709.60347598489525821488
NumOutput =
-127.0764e+009

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Number Theory dans Help Center et File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by