I'm having an issue defining the initial conditions for solving a system of differential equations

syms x Q M w(x) th(x)
%Givens
l = 10;
E = 100;
G = 40;
I = 0.1;
A = 1;
q = -1;
m = 0;
assume(0 <= x <= l);
assume(x,"real");
%Constituative Equations
Q = G*A*(diff(w,x)-th); %shear force
M = E*I*diff(th,x); %bending moment
%GDE
GDE1 = diff(M,x) + Q + m == 0;
GDE2 = diff(Q,x) + q == 0;
%BC's (Pinned at both ends)
cond = [M(0)==0,M(l)==0,Q(0)==-q*l/2,Q(l)==-q*l/2, w(0)==0, w(l)==0];
%Set up the differential equations
eqns = [GDE1,GDE2];
[w_sol, th_sol] = dsolve(eqns, cond);
disp("w(x)=");
disp(simplify(w_sol));
disp("theta(x) =");
disp(simplify(th_sol));
I'm having difficulty defining the initial conditions to solve this system of equations. Here is the error I keep getting:
Error using mupadengine/feval_internal
Invalid initial conditions.
Error in dsolve>mupadDsolve (line 334)
T = feval_internal(symengine,'symobj::dsolve',sys,x,options);
Error in dsolve (line 203)
sol = mupadDsolve(args, options);
Error in Problem_1 (line 36)
[w_sol, th_sol] = dsolve(eqns, cond);
Related documentation

 Accepted Answer

You have two second-order ODEs for th and w.
Thus you need 4 boundary conditions (not 6) that can be prescribed for w, dw/dx, th or dth/dx at the endpoints of the interval [0 l].
In your formulation, conditions for M or Q are not possible, but these can easily be transformed to conditions that only contain the above mentionned 4 variables w, dw/dx, th or dth/dx.
Setting boundary conditions for M and Q works, e.g., like done below. I don't know why directly solving for the constants as
[w_sol, th_sol] = dsolve(eqns,cond);
still is a problem.
syms x Q(x) M(x) w(x) th(x)
%Givens
l = 10;
E = 100;
G = 40;
I = 0.1;
A = 1;
q = -1;
m = 0;
assume(0 <= x <= l);
assume(x,"real");
%Constituative Equations
Q = G*A*(diff(w,x)-th); %shear force
M = E*I*diff(th,x); %bending moment
%GDE
GDE1 = diff(M,x) + Q + m == 0;
GDE2 = diff(Q,x) + q == 0;
%BC's (Pinned at both ends)
cond = [M(0)==0,M(l)==0,Q(0)==-q*l/2,Q(l)==-q*l/2];%, w(0)==0, w(l)==0];
%Set up the differential equations
eqns = [GDE1,GDE2];
[w_sol, th_sol] = dsolve(eqns);
Q_sol = subs(Q,[w,th],[w_sol,th_sol]);
M_sol = subs(M,[w,th],[w_sol,th_sol]);
[C1,C2,C3,C4] = solve([subs(M_sol,x,0)==0,subs(M_sol,x,l)==0,subs(Q_sol,x,0)==-q*l/2,subs(Q_sol,x,l)==-q*l/2]);
w_sol = simplify(subs(w_sol));
th_sol = simplify(subs(th_sol));
disp("w(x)=");
w(x)=
disp(w_sol);
disp("theta(x) =");
theta(x) =
disp(th_sol);

1 Comment

Thank you so much for the help! I see putting the conditions in terms that only contain the above mentioned 4 variables w, dw/dx, th or dth/dx, but there is still a constant. The substitution after solving worked the best. I really appreciate the help.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2023a

Asked:

on 24 Apr 2024

Commented:

on 24 Apr 2024

Community Treasure Hunt

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

Start Hunting!