Symbolic Linear system returns wrong solution.

2 views (last 30 days)
I would like to solve the symbolic defined integrals U and V in terms of the variable X, how can I do that?
syms C0 C1 C2 C3 C4 X L EI q;
%__________________________________________________
% POLYNOMIAL 4TH
Y3(X) = C0 + C1*X + C2*X^2 + C3*X^3 + C4*X^4;
% Y3(X) DERIVATIVES:
dY3(X) = diff(Y3(X),X);
d2Y3(X) = diff(dY3(X),X);
% RAYLEIGH RITZ METHOD
U = + (EI/2) * int((d2Y3(X))^2,[0 L]);
V = - q * int(Y3(X),[0 L]);
PI = U + V;
% BOUNDARY CONDITIONS IN Y3(X)
cc1 = Y3(0) == 0;
cc2 = Y3(L) == 0;
cc3 = -EI*d2Y3(L) == 0;
cc4 = -EI*d2Y3 (0) == 0;
% NEW BOUNDARY CONDITION FROM THE RR METHOD
dPIdC4 = diff (PI,C4);
cc5 = dPIdC4 == 0;
% SYSTEM LINEAR SOLVING
R = solve([cc1,cc2,cc3,cc4,cc5],[C0,C1,C2,C3,C4]);
C0 = R.C0;
C1 = R.C1;
C2 = R.C2;
C3 = R.C3;
C4 = R.C4;
disp 'CONSTANTES C'
disp ([C0;C1;C2;C3;C4]);
Y3(X) = C0 + C1*X + C2*X^2 + C3*X^3 + C4*X^4;
disp 'EQUAÇÃO DA LINHA ELÁSTICA';
disp (Y3(X));
disp 'EQUAÇÃO DO MOMENTO';
M3(X) = -EI * diff(diff(Y3(X),X),X);
disp(M3(X));
As it is, the the integral solution for U and V is in terms of X, what is wrong. 'X' should disappear .
  2 Comments
Walter Roberson
Walter Roberson on 19 Apr 2021
specify the variable of integration for int()
Tiago Araujo
Tiago Araujo on 19 Apr 2021
Even doing this, I am not getting correct values... I dont know why.
I did:
clear all;clc;
syms C0 C1 C2 C3 C4 X L EI q;
%__________________________________________________
% POLYNOMIAL 4TH
Y3(X) = C0 + C1*X + C2*X^2 + C3*X^3 + C4*X^4;
% Y3(X) DERIVATIVES:
dY3(X) = diff(Y3(X),X);
d2Y3(X) = diff(dY3(X),X);
% RAYLEIGH RITZ METHOD
U = + int((EI/2)*(d2Y3(X))^2,X,[0 L]);
V = - int(q*Y3(X),X,[0 L]);
PI = U + V;
% BOUNDARY CONDITION FROM THE RR METHOD
%dPIdC2 = diff (PI,C2);
%dPIdC3 = diff (PI,C3);
dPIdC4 = diff (PI,C4);
%cc3 = dPIdC2 == 0;
%cc4 = dPIdC3 == 0;
cc5 = dPIdC4 == 0;
% ESSENTIAL BOUNDARY CONDITIONS IN Y3(X)
cc1 = Y3(0) == 0;
cc2 = Y3(L) == 0;
cc3 = -EI*d2Y3(L) == 0;
cc4 = -EI*d2Y3 (0) == 0;
% SYSTEM LINEAR SOLVING
R = solve([cc1,cc2,cc3,cc4,cc5],[C0,C1,C2,C3,C4]);
C0 = R.C0;
C1 = R.C1;
C2 = R.C2;
C3 = R.C3;
C4 = R.C4;
disp 'CONSTANTS C'
disp ([C0;C1;C2;C3;C4]);
disp 'PI';
disp(PI);
disp 'METHOD RR - ELASTIC CURVE EQUATION';
Y3(X) = C0 + C1*X + C2*X^2 + C3*X^3 + C4*X^4;
disp (Y3(X));
disp 'ANALYTICAL - ELASTIC CURVE EQUATION';
Yr(X) = - (q*X)/(24*EI) * (X^3 - 2*L*X^2 + L^3);
disp (Yr(X));
disp 'METHOD RR - MOMENT EQUATION';
M3(X) = -EI * diff(diff(Y3(X),X),X);
disp(M3(X));
disp 'ANALYTICAL - MOMENT EQUATION';
Mr(X) = -EI* diff((diff (Yr,X)),X);
disp(Mr(X));
I should get the results of the attached image, or the same as analytical equations...

Sign in to comment.

Accepted Answer

Divija Aleti
Divija Aleti on 21 Apr 2021
Hi Tiago,
I understand that you are getting wrong solutions but there is nothing wrong with the working of the code. I suggest you re-check your initial assumption of Y3(X) as a polynomial (try taking a combination of trigonometric functions and later use Taylor series expansion to expand them) or maybe try using different boundary conditions.
Hope this helps!
Regards,
Divija

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!