Can someone confirm my differentiation code is correct?

I need to differentiate P(a,u,EA1,EA2) with respect to u. I get the code to run, but im not sure the answer is correct since it gives me a long answer.
syms L10(a) L1(a,u) epsilon1(a,u) L20(a) N1(a,u,EA1) N2(a,u,EA2) P(a,u,EA1,EA2)
L10(a) = 2*a;
L20(a) = sqrt(5)*a;
L1(a,u) = sqrt((2*a)^2+u^2);
L2(a,u) = sqrt((2*a)^2+(a-u)^2);
epsilon1(a,u) = (L1(a,u)-L10(a))/L10(a);
epsilon2(a,u) = (L2(a,u)-L20(a))/L20(a);
N1(a,u,EA1) = EA1*epsilon1(a,u);
N2(a,u,EA2) = EA2*epsilon2(a,u);
P(a,u,EA1,EA2) = (u/(L1(a,u)))*(N1(a,u,EA1))-((a*u)/(L2(a,u)))*(N2(a,u,EA2));
df = diff(P(a,u,EA1,EA2),u)

3 件のコメント

darova
darova 2019 年 9 月 8 日
Why are you surprised?
Function you want to differentiate
22Untitled.png
You didn't attach source formula or equations. How can we verify if it's correct?
Ruslan Khoguev
Ruslan Khoguev 2019 年 9 月 9 日
I meant does the code make sense? Am I differentiating P(a,u,EA1,EA2) with respect to u correctly?
Walter Roberson
Walter Roberson 2019 年 9 月 9 日
Yes, that is correct syntax for differentiating the expression returned by P(a,u,EA1,EA2) with respect to u.

サインインしてコメントする。

 採用された回答

Devineni Aslesha
Devineni Aslesha 2019 年 9 月 11 日

1 投票

The code written to differentiate P (a, u, EA1, EA2) with respect to u is correct. It will give correct result. The reason for the answer to be long might be because of the display of all the terms in the differentiated output.

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by