How to express constants of integral

4 ビュー (過去 30 日間)
kk123k
kk123k 2025 年 5 月 16 日
コメント済み: Sam Chak 2025 年 5 月 16 日
Hi everyone,
I am a matlab beginner. How can I find the constants of integral C1 and C2 ?
For example i know that, how can i find constants of integral C1 and C2 in this script? Thanks :)
syms x
y1 = exp(-2*x+sqrt(6)*x);
y2 = exp(-2*x-sqrt(6)*x);
g = 2*x^2-3*x+6;
A = [y1 y2;diff(y1,x) diff(y2,x)]
A = 
b = [0; g]
b = 
A\b
ans = 
u = simplify(A\b)
u = 
u = int(u,x)
u = 
simplify(u)
ans = 
  2 件のコメント
Torsten
Torsten 2025 年 5 月 16 日
What is C1 and C2 in your script ? If you mean the 2x1 vector u: there are no constants because of the multiplication by the exp(...) term.
kk123k
kk123k 2025 年 5 月 16 日
I'm sorry. I explained it wrong
How can express C1 and C2 in simplify(u) ?
The answer i want is
C1 +
C2+

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

採用された回答

Torsten
Torsten 2025 年 5 月 16 日
移動済み: Sam Chak 2025 年 5 月 16 日
MATLAB's "int" only returns one possible antiderivative.
If you want to show the free integration constants, you could use "dsolve" which is usually used for the symbolic solution of more complicated ordinary differential equations:
syms x
y1 = exp(-2*x+sqrt(6)*x);
y2 = exp(-2*x-sqrt(6)*x);
g = 2*x^2-3*x+6;
A = [y1 y2;diff(y1,x) diff(y2,x)]
A = 
b = [0; g]
b = 
A\b
ans = 
u = simplify(A\b)
u = 
syms v1(x) v2(x)
v(x) = [v1(x);v2(x)];
u = dsolve(diff(v,x)==u);
simplify(u.v1)
ans = 
simplify(u.v2)
ans = 
  4 件のコメント
kk123k
kk123k 2025 年 5 月 16 日
移動済み: Sam Chak 2025 年 5 月 16 日
Thank you ! :)
Sam Chak
Sam Chak 2025 年 5 月 16 日
@kk123k, If you find the solution using 'dsolve()' helpful, please consider clicking 'Accept' ✔ on the answer.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by