Using syms, after finding diff(x,y) how to insert initial condition into diff's

1 回表示 (過去 30 日間)
Terry Poole
Terry Poole 2021 年 9 月 20 日
回答済み: Behzad Eydiyoon 2021 年 9 月 20 日
So, I'm relatively new to using syms in matlab and am stuck, I have the equation and its partials solved, now I need to insert initial conditions of u1 = 0 into the solved partial derivatives. I tried doing f@ u1 = 0, to solve the function with the idea that I could take the diff's of the solved function over again but matlab is throwing an error with that approach.
syms x1 x2 u1 s1
f = 9*x1^2 - 18*x1*x2 +13*x2^2 - 4 ...
+ u1*(x1^2 + x2^2 + 2*x1 - 16 + s1^2);
diff(f, x1)
diff(f, x2)
diff(f, u1)
diff(f, s1)
f@ u1 = 0

回答 (1 件)

Behzad Eydiyoon
Behzad Eydiyoon 2021 年 9 月 20 日
syms x1 x2 u1 s1
f = 9*x1^2 - 18*x1*x2 +13*x2^2 - 4 ...
+ u1*(x1^2 + x2^2 + 2*x1 - 16 + s1^2);
A=diff(f, x1);
B=diff(f, x2);
C=diff(f, u1);
D=diff(f, s1);
u1=0;
eval(A)
eval(B)
eval(C)
eval(D)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by