solving symbolic differential equations, error when using dsolve
Mostrar comentarios más antiguos
Hello Everyone,
i'm new to Matlab and i'm trying to solve differential equations of mechanical systems (bernoulli beams).
I think my problem can be best described with a short example:
%simple example:
syms x z
syms EI L q
syms w(x) u(x)
syms qz(x) qx(x)
%given values
qz(x) = q;
qx(x) = q;
EA = EI /L^2;
%differential equations
eq1 = diff(w,x,4)==qz/EI;
eq2 = diff(u,x,2)==qx/EA;
ddw = diff(w,x,2);
My = -EI * ddw;
%boundary conditions
cond_1 = w(0) == 0;
cond_2 = My(0) == 0;
cond_3 = My(L) == 0;
cond_4 = w(L) == 0;
cond_5 = u(0) == 0;
cond_6 = u(L) == 0;
conds1 = [cond_1, cond_2, cond_3, cond_4];
conds2 = [cond_5, cond_6];
conds3 = [cond_1, cond_2, cond_3, cond_4, cond_5, cond_6];
S1 = dsolve(eq1, conds1) %works
S2 = dsolve(eq2, conds2) %works
S3 = dsolve(eq1, eq2, conds3) %doesnt work
In the first very simple example it es ovious, that i can solve w(x) seperate from u(x). But in want to solve more complex systems like the following one.
%more complex mechanical system:
syms w1(x) w2(x) w3(x) u1(x) u2(x) u3(x)
syms EI EA L q
%given values:
qz1 = q;
qz2 = (q * x) / L;
qz3 = 0;
qx1 = 0;
qx2 = 0;
qx3 = (q * x) / L;
EI1 = inf;
EI2 = EI;
EI3 = EI;
EA1 = EI / L^2;
EA2 = inf;
EA3 = EI / L^2;
%equations:
eqn1 = diff(w1,x,4)==qz1/EI1;
eqn2 = diff(w2,x,4)==qz2/EI2;
eqn3 = diff(w3,x,4)==qz3/EI3;
eqn4 = diff(u1,x,2)==-qx1/EA1;
eqn5 = diff(u2,x,2)==-qx3/EA2;
eqn6 = diff(u3,x,2)==-qx3/EA3;
eqns = [eqn1, eqn2, eqn3, eqn4, eqn5, eqn6];
DDDw1 = diff(w1,x,3);
DDDw2 = diff(w2,x,3);
DDDw3 = diff(w3,x,3);
DDw1 = diff(w1,x,2);
DDw2 = diff(w2,x,2);
DDw3 = diff(w3,x,2);
Dw1 = diff(w1,x);
Dw2 = diff(w2,x);
Dw3 = diff(w3,x);
My1 = -EI1 * DDw1;
My2 = -EI2 * DDw2;
My3 = -EI3 * DDw3;
Qz1 = -EI1 * DDDw1;
Qz2 = -EI2 * DDDw2;
Qz3 = -EI3 * DDDw3;
Du1 = diff(u1,x);
Du2 = diff(u2,x);
Du3 = diff(u3,x);
Nx1 = EA1 * Du1;
Nx2 = EA2 * Du2;
Nx3 = EA3 * Du3;
%boundary conditions:
condA1 = sqrt(3)==w1(0)/u1(0);
condA2 = Qz1(0)*(sqrt(3)/2)+Nx1(0)*(1/2)==0;
condA3 = Dw1 == 0;
condB1 = My1(L)==0;
condB2 = w1(L)==w1(0);
condB3 = u2(0)==w1(L)*(sqrt(3)/2)-u1(L)*(1/2);
condB4 = w2(0)==w1(L)*(1/2)-u1(L)*(sqrt(3)/2);
condB5 = Du2 == 0;
condB6 = u2(0) == u2(L);
condC1 = Qz2(L)==Qz3(0);
condC2 = My2(L)==My3(0);
condC3 = Dw2(L)==Dw3(0);
condC4 = w2(L)==w3(0);
condC5 = Nx2(L)==Nx3(0);
condC6 = u2(L)==u3(0);
condD1 = My3(L)==0;
condD2 = w3(L)==0;
condD3 = u3(L)==0;
condsA = [condA1, condA2, condA3];
condsB = [condB1, condB2, condB3, condB4, condB5, condB6];
condsC = [condC1, condC2, condC3, condC4, condC5, condC6];
condsD = [condD1, condD2, condD3];
conds = [condsA, condsB, condsC, condsD];
%solve equation system with boundary conditions:
S = dsolve(eqns, conds) %doesnt work, i guess because of the same reason as in the first example
I get the following output:
Error using mupadengine/feval_internal
Invalid equation or initial condition.
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 baumechanik2_hue2_v2 (line 92)
S = dsolve(eqns, conds)
Why does this not work and is how can i solve this problem?
I am using R2022b
Thank you in advance!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

