How do you solve for constants in a system of equations?
Show older comments
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
on 29 Oct 2021
What is
when
? If you can get
, then you can find all of them in this order
,
,
,
.
? If you can get
, while Answers (1)
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.C1 sol.C2 sol.C3 sol.C4]
It looks like C3 must be zero, C2 can be anything, and C1 and C4 have the values shown, as long as
sol.conditions
3 Comments
Yes,
, and this can be obtained from the 3rd equation when
.
.By rights,
is obtainable as well when
.
.When
, we know the relationship
from
, and we can express
from the 3rd equation.
Since
, and making the substitution
in
, we can possibly solve for
as a function of
, which is
.
If
, then logically, we can find
, followed by
.
Since MATLAB returns the value for
as a function of the known constants, isn't it true that we can fully find
as well?
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)
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)]
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)]
But apparently they are equal to each other for any z
simplify(s1(L/2)-s2(L/2))
And similarly for the contraints on v1(L/2) and v2(L/2)
[v1(L/2) v2(L/2)]
simplify(v1(L/2)-v2(L/2))
It appears that the given conditions are insufficient to uniquely specify C2.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!