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

7 次查看(过去 30 天)
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))

采纳的回答

Star Strider
Star Strider 2017-1-23
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 个评论
Mallouli Marwa
Mallouli Marwa 2017-1-23
If i want to comput the derived function in a point y=40 "df_dy(40)"
I obtain this error
Error using mupadmex
Error in MuPAD command: Index exceeds matrix dimensions.
Star Strider
Star Strider 2017-1-23
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by