solve a partial differential equation

4 vues (au cours des 30 derniers jours)
Yuchi Kang
Yuchi Kang le 20 Oct 2018
Modifié(e) : Stephan le 21 Oct 2018
Hi! I want to solve a second partial differential equation.
The general solution is
Which command should I use to get the general solution? I think dsolve doesn't work well. Thanks for helping me.
  1 commentaire
madhan ravi
madhan ravi le 21 Oct 2018
Upload your code

Connectez-vous pour commenter.

Réponse acceptée

Stephan
Stephan le 21 Oct 2018
Hi,
the following code solves the equation with the initial conditions:
y(0)=0
dy/dx(0)=0
Then it rewrites the result in terms of sin ans cos:
syms y(x) x E I N P c l Dyt(x)
eqn = E*I*diff(y,x,2)+N*y == -P*c/l*x;
[eqns, vars] = reduceDifferentialOrder(eqn,y);
conds = [y(0)==0,Dyt(0)==0];
sol = dsolve(eqns,conds);
sol_sin = simplify(rewrite(sol.y,'sin'))
I think that was the question.
Best regards
Stephan
  10 commentaires
Stephan
Stephan le 21 Oct 2018
Modifié(e) : Stephan le 21 Oct 2018
yes - this is what subs is for - i would suggest to this before reducing the differential order:
syms y(x) x E I N P c l Dyt(x) k
eqn = diff(y,x,2)+N/E*I*y == -P*c/(l*E*I)*x;
eqn = subs(eqn,(N/E*I),k^2)
[eqns, vars] = reduceDifferentialOrder(eqn,y);
conds = [y(0)==0,Dyt(0)==0];
sol = dsolve(eqns,conds)
sol_sin = rewrite(sol.y,'sin')
which gives:
sol_sin =
- ((P*c*1i)/(2*E*I*k^3*l) + (P*c*(- 1 + k*x*1i)*(sin(k*x)*1i - 2*sin((k*x)/2)^2 + 1)*1i)/(2*E*I*k^3*l))*(sin(k*x)*1i + 2*sin((k*x)/2)^2 - 1) - ((P*c*1i)/(2*E*I*k^3*l) + (P*c*(1 + k*x*1i)*(sin(k*x)*1i + 2*sin((k*x)/2)^2 - 1)*1i)/(2*E*I*k^3*l))*(sin(k*x)*1i - 2*sin((k*x)/2)^2 + 1)
You can also get rid of the imaginary parts of the results by making some assumptions. For example i suspect E to be youngs modul, which should be a real number and positive always:
syms y(x) x E I N P c l Dyt(x) k
eqn = diff(y,x,2)+N/E*I*y == -P*c/(l*E*I)*x;
eqn = subs(eqn,(N/E*I),k^2)
[eqns, vars] = reduceDifferentialOrder(eqn,y);
conds = [y(0)==0,Dyt(0)==0];
assume([x P c l k],'real');
assumeAlso(c>=0 & l>=0 & k>=0);
assumptions
sol = dsolve(eqns,conds)
sol_sin = rewrite(sol.y,'sin')
results in:
sol_sin =
(P*c*sin(k*x))/(E*I*k^3*l) - (P*c*x)/(E*I*k^2*l)
You should check if the assumptions i made are correct in your case and modify them if needed.
Stephan
Stephan le 21 Oct 2018
If this answer was helpful to you, please accept it.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by