How do you solve for constants in a system of equations?

9 views (last 30 days)
Good Morning,
I'm trying to determine how to solve for constants in a system of equations with specified conditions. Please see the below forumlaic explanation. I've explored using "solve", but am unsure how to set the condition values as seed for the solution. FYI, this is for solving a cantilever beam deflection with varying cross section (changing area moment of inertia). This is a simplistic representation of the problem by solving for only two distinct sections, but in practice there would be many more depending on the considered sampling length.
Thank you for any feedback or hints for functions to explore.
P, L, E1 & E2 are all known values
s1=(P/(2*E*I1))*(2*L*x-x^2)+C1*x;
s2=(P/(2*E*I2))*(2*L*x-x^2)+C2*x;
v1=(P/(6*E*I1))*(3*L*x^2-x^3)+C1*x+C3;
v2=(P/(6*E*I2))*(3*L*x^2-x^3)+C2*x+C4;
at x=0 s1=0 and v1=0
at x=L/2 s1=s2, and v1=v2
  1 Comment
Sam Chak
Sam Chak on 29 Oct 2021
What is when ? If you can get , then you can find all of them in this order , , , .
, are found when , while , can be found when .

Sign in to comment.

Answers (1)

Paul
Paul on 30 Oct 2021
syms P L E1 E2 % are all known values, E1 and E2 not used?
syms I1 I2 E % also known values?
syms C1 C2 C3 C4
syms x
s1(x) = (P/(2*E*I1))*(2*L*x-x^2)+C1*x;
s2(x) = (P/(2*E*I2))*(2*L*x-x^2)+C2*x;
v1(x) = (P/(6*E*I1))*(3*L*x^2-x^3)+C1*x+C3;
v2(x) = (P/(6*E*I2))*(3*L*x^2-x^3)+C2*x+C4;
% at x=0 s1=0 and v1=0
eqn1 = s1(0) == 0;
eqn2 = v1(0) == 0;
% at x=L/2 s1=s2, and v1=v2
eqn3 = s1(L/2) == s2(L/2);
eqn4 = v1(L/2) == v2(L/2);
sol = solve([eqn1 eqn2 eqn3 eqn4],[C1 C2 C3 C4],'ReturnConditions',true)
sol = struct with fields:
C1: (3*I1*L*P - 3*I2*L*P + 4*E*I1*I2*z)/(4*E*I1*I2) C2: z C3: 0 C4: ((- 5*P*L^3 + 18*P*L^2)*(I1 - I2))/(48*E*I1*I2) parameters: z conditions: L ~= 0
[sol.C1 sol.C2 sol.C3 sol.C4]
ans = 
It looks like C3 must be zero, C2 can be anything, and C1 and C4 have the values shown, as long as
sol.conditions
ans = 
  3 Comments
Paul
Paul on 30 Oct 2021
It appears that the contraints are not sufficient to specify C2.
syms P L E1 E2 % are all known values, E1 and E2 not used?
syms I1 I2 E % also known values?
syms C1 C2 C3 C4
syms x
s1(x) = (P/(2*E*I1))*(2*L*x-x^2)+C1*x;
s2(x) = (P/(2*E*I2))*(2*L*x-x^2)+C2*x;
v1(x) = (P/(6*E*I1))*(3*L*x^2-x^3)+C1*x+C3;
v2(x) = (P/(6*E*I2))*(3*L*x^2-x^3)+C2*x+C4;
% at x=0 s1=0 and v1=0
eqn1 = s1(0) == 0;
eqn2 = v1(0) == 0;
% at x=L/2 s1=s2, and v1=v2
eqn3 = s1(L/2) == s2(L/2);
eqn4 = v1(L/2) == v2(L/2);
sol = solve([eqn1 eqn2 eqn3 eqn4],[C1 C2 C3 C4],'ReturnConditions',true)
sol = struct with fields:
C1: (3*I1*L*P - 3*I2*L*P + 4*E*I1*I2*z)/(4*E*I1*I2) C2: z C3: 0 C4: ((- 5*P*L^3 + 18*P*L^2)*(I1 - I2))/(48*E*I1*I2) parameters: z conditions: L ~= 0
Now substitute the solution back into the functions:
s1(x) = subs(s1(x),[C1 C2 C3 C4],[sol.C1 sol.C2 sol.C3 sol.C4]);
s2(x) = subs(s2(x),[C1 C2 C3 C4],[sol.C1 sol.C2 sol.C3 sol.C4]);
v1(x) = subs(v1(x),[C1 C2 C3 C4],[sol.C1 sol.C2 sol.C3 sol.C4]);
v2(x) = subs(v2(x),[C1 C2 C3 C4],[sol.C1 sol.C2 sol.C3 sol.C4]);
Evaluate at the constraint conditions. The first two at x =0:
[s1(0) v1(0)]
ans = 
Now we see that s1(L/2) and s2(L/2) are both dependent on the free parameter z = C2
[s1(L/2) s2(L/2)]
ans = 
But apparently they are equal to each other for any z
simplify(s1(L/2)-s2(L/2))
ans = 
0
And similarly for the contraints on v1(L/2) and v2(L/2)
[v1(L/2) v2(L/2)]
ans = 
simplify(v1(L/2)-v2(L/2))
ans = 
0
It appears that the given conditions are insufficient to uniquely specify C2.
Sam Chak
Sam Chak on 30 Oct 2021
Hi @Paul,
Thank you for the analysis. I learned something new on using the subs function to validate the results.

Sign in to comment.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!