Borrar filtros
Borrar filtros

Differential Equation Solution incorrect with matlab compared to maple

2 visualizaciones (últimos 30 días)
Hello everyone, currently I am trying to solve a differential equation relating to a beam problem, the problem I am having is that is seems maple gives better results for the exact solution than matlab does, in fact, the solution i am getting from matlab is pretty unusable.
I have a feeling the issue is with my code, of course, but I cannot seem to find it.
Here is the differential equation:
EI = 10000*[2-(x/L)] , q = 40 * (x/L)^2, and L = 10
Here is the result of maple code
as well as it's plot
Here is the code I am running, as can be seen in wSol(x), it is imaginary, which is pretty contrary to what Maple provides.
syms x w(x)
L=10;
q0=40;
a0=10000;
M1=-1000;
Q1=-100;
q=q0*(x/L)^2;
EI=a0*(2-(x/L));
Dw = diff(w,x) ;
D2w = diff(w,x,2);
D3w = diff(w,x,3);
deq = diff(EI*diff(w,x,2),x,2)==q;
cond1 = w(0)==0;
cond2 = Dw(0)==0;
cond3 = D2w(L)==M1/subs(EI,L);
cond4 = D3w(L)==(Q1-(subs(diff(EI,x),L)*M1/subs(EI,L)))/subs(EI,L);
conds=[cond1 cond2 cond3 cond4]
conds = 
wSol(x) = dsolve(deq,conds)
wSol(x) = 

Respuesta aceptada

Paul
Paul el 6 de Mzo. de 2022
Editada: Paul el 6 de Mzo. de 2022
The Maple solution does include imaginary terms, like 5*pi*1i/3, but we'll show that those terms cancel out on the interval of interest.
syms x real % in case this has an impact
syms w(x)
L=10;
q0=40;
a0=10000;
M1=-1000;
Q1=-100;
q=q0*(x/L)^2;
EI=a0*(2-(x/L));
Dw = diff(w,x) ;
D2w = diff(w,x,2);
D3w = diff(w,x,3);
deq = diff(EI*diff(w,x,2),x,2)==q;
cond1 = w(0)==0;
cond2 = Dw(0)==0;
cond3 = D2w(L)==M1/subs(EI,L);
cond4 = D3w(L)==(Q1-(subs(diff(EI,x),L)*M1/subs(EI,L)))/subs(EI,L);
conds=[cond1 cond2 cond3 cond4]
conds = 
wSol(x) = dsolve(deq,conds)
wSol(x) = 
The solution contains a term of the form:
term = (x-20)*(5*sym(pi)*1i/3 - 5*log(x-20)/3)
term = 
or focusing only on the term in the parentheses after multiplying by 3/5
term = sym(pi)*1i - log(x-20)
term = 
Over the solutions interval of interest, 0 <= x <= L, the argumument to the log function is negative real. Using the rule for log of a negative number: log(x-20) = log(20-x) + i * pi. So we have
term = - log(20-x)
term = 
and the imaginary part disappears. So make that assumption explicitly and simplify the solution.
assume(0 <= x <= L) % only care about the solution over this interval
wSol(x) = simplify(expand(wSol(x))) % expand and simplify the solution using the assumption
wSol(x) = 
fplot(wSol(x),[0 L]) % looks like the Maple plot
  2 comentarios
Ramses Young
Ramses Young el 6 de Mzo. de 2022
Wow that makes a lot of sense!!!
I can see how limiting the domain of interests affects the imaginary portion, but can you explain how using the simplify command makes it not have the imaginary part in it?

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by