Proof-checking a ODE solution
2 views (last 30 days)
Show older comments
Hi, MATLAB online solves this:
if true
% code
end
syms a h Y(x) g x B E
eqn = (h^2)*diff(Y,x, 2) + (2*i*h*g)*diff(Y,x) + (g^2 - E)*Y == 0;
DY = diff(Y)
cond1 = Y(0) == 1;
cond2 = DY(0) == 0;
Y(x) = dsolve(eqn, cond)
however MATLAB on the computer, 2017 a, does not solve it, and I get :
diff(Y(x), x)
Not enough input arguments.
Error in cond (line 24) if issparse(A)
Error in PDE_sol (line 6) Y(x) = dsolve(eqn, cond)
Which one should I "believe" in?
0 Comments
Accepted Answer
Birdman
on 2 Jan 2018
Replace the line
Y(x) = dsolve(eqn, cond)
with
Y(x) = dsolve(eqn, [cond1 cond2])
9 Comments
Sana Syed
on 28 Feb 2018
If I have 2 coupled 4th order non linear ODEs and 8 BCS it should take in the 8 conditions right? Its not accepting any of the boundary conditions which are non linear.
syms uy(x) txd(x) uz(x) ux(x); %Beam Dimensions Ty=0.001,Tz=0.01,L=0.1; %Constants based on dimensions from excel calculations c21=42.5015,c22=8.42*10^-4,c3=374.81,a=100,d=0.03; %Loading Conditions normalized loads fxl=0,fyl=0,myl=0,fzl=0,mzl=0,mxdl=0.3125,myl=0;%Pure twisting
%Differential Equations Input ode1=diff(uy,x,4)-fxl*diff(uy,x,2)==-myl*diff(txd,x,2)-2*fzl*diff(txd,x)+(1-x)*fzl*txd; %For pure twisting, it reduces to D4y/Dx4=0; ode2=(c21+c22*fxl)*diff(txd,x,2)-c3*diff(txd,x,4)-(myl-fzl*(1-x))*(mzl+fyl*(1-x)-fxl*(uy(L)-uy)-(myl-fzl*(1-x))*txd)==0; %ode2=(c21+c22*fxl)*diff(txd,x,2)-c3*diff(txd,x,4)==0; ode3=diff(uz,x,2)==txd*diff(uy,x,2)-(myl-fzl*(1-x))/a; %ode3=diff(uz,x,2)==txd*diff(uy,x,2)-(1/a)*(myl-fzl*(1-x)); ode4=d*(diff(ux,x)+0.5*(diff(uy,x))^2+0.5*(diff(uz,x))^2)+(((a+1)*(diff(txd,x))^2)/2)==fxl; %End of Differential Equations Input
%Define Derivative values in terms of variables Duy=diff(uy,x); D2uy=diff(uy,x,2); D3uy=diff(uy,x,3); Dtxd=diff(txd,x); D2txd=diff(txd,x,2); D3txd=diff(txd,x,3); Duz=diff(uz,x); D2uz=diff(uz,x,2); D3uz=diff(uz,x,3); %End of Derivative values in terms of variables
%Geometric Boundary Conditions cond1=ux(0)==0; cond2=uy(0)==0; cond3=uz(0)==0; cond4=txd(0)==0; cond5=Duz(0)==0; cond6=Duy(0)==0; cond7=Dtxd(0)==0; cond8=Dtxd(L)==0; %End of Geometric Boundary conditions
%Loading Boundary conditions
%THIS END CONDITION GIVES ERROR: cond9=-D3uy(L)-a*(2*txd(L)*Dtxd(L)*D2uy(L)+txd(L)^2*D3uy(L)-txd(L)*D3uz(L)-Dtxd(L)*D2txd(L))+fxl*Duy(L)==fyl;
%THIS CONDITION ALSO GIVES ERROR cond10=D2uy(L)+a*(txd(L)*D2uy(L)-D2uz(L))*txd(L)==mzl
cond11=-c3*D3txd(L)==mxdl;
%odes=[ode1 ode2 ode3 ode4]
odes=[ode1 ode2]
conds=[cond2 cond4 cond6 cond7 cond8]
%[uySol(x), txSol(x), uzSol(x), uxSol(x)] = dsolve(odes,conds)
[uySol(x), txSol(x)] = dsolve(odes,conds)
More Answers (0)
See Also
Categories
Find more on Equation Solving 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!