Integrals with syms over the variable x

1 回表示 (過去 30 日間)
Daniel Arvidsson
Daniel Arvidsson 2021 年 1 月 22 日
コメント済み: Daniel Arvidsson 2021 年 1 月 24 日
Hi!
I want to solve the following integrals but i want it to integrate over the variable x while c1, c2 and c3 are constants that are not known beforehand but the plan is to get my 3 equations so i can solve the equationsystem after the integrations for c1,c2 and c3. Can someone help me, please? The code i got so far is the one below.
My 3 equations:
% Galerkin method
A0=6e-4;
E=70e9;
L=0.5;
P=5000;
syms c1 c2 c3
e1=E*A0*x * (c1*(2 - (x/L)) + c2*(4*x - 2* (x^2) *(1/L)) + c3*(6*(x^2) - 3*(x^3)*(1/L)) - P)
e2=E*A0*x^2 * (c1*(2 - (x/L)) + c2*(4*x - 2* (x^2) *(1/L)) + c3*(6*(x^2) - 3*(x^3)*(1/L)) - P)
e3=E*A0*x^3 * (c1*(2 - (x/L)) + c2*(4*x - 2* (x^2) *(1/L)) + c3*(6*(x^2) - 3*(x^3)*(1/L)) - P)
F1=int(e1, L ,0);
F2=int(e2, L, 0);
F3=int(e3, L, 0);
  4 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 1 月 24 日
Good!
Walter's advice to explicitly state the variable of integration is good. Matlab use a reasonably clever procedure to decide that, but if one are explicit about it things will not go wrong.
Daniel Arvidsson
Daniel Arvidsson 2021 年 1 月 24 日
Yes, very true, thanks for input Björn! :)

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

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 1 月 22 日
If you have the symbolic toolbox this can be done:
syms E A0 L P c1 c2 c3 P x
e1=E*A0*x * (c1*(2 - (x/L)) + c2*(4*x - 2* (x^2) *(1/L)) + c3*(6*(x^2) - 3*(x^3)*(1/L)) - P);
F1=int(e1, L ,0)
% Returns:
% F1 =
%
% -(A0*E*L^2*(27*c3*L^2 + 25*c2*L - 15*P + 20*c1))/30
The symbolic toolbox should also be able to solve the 3 eqs for c1, c2, and c3.
But considering that you have 3 polynomials in x, you should be able to calculate the integrals by hand easily.
HTH
  2 件のコメント
Walter Roberson
Walter Roberson 2021 年 1 月 22 日
I recommend specifying the variable of integration explicitly, as there are four variables in e1 and it is clearer to specify the variable of integration instead of requiring that the person reading the code be completely certain about the procedure for chosing the default variable.
Daniel Arvidsson
Daniel Arvidsson 2021 年 1 月 24 日
Very true, Walter, thanks for input :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by