When I attempted to integrate it analytically with my additions (including ‘dP’ and ‘d2P’), the result was an empty sym for ‘SPv’.
Not all differential equations have analytic integrations. If you want a numerical result, use the odeToVectorField and matlabFunction functions to create an anonymous function that the numerical ODE solvers can use ...
...such as:
syms x y P(x) P0 dP0 t Y
dP = diff(P);
d2P = diff(dP);
l=20e-6;
e=0.06;
d=e*l/2;
k=0;
re=300;
rs=e;
rb=1/e;
ga=1.4;
pr=0.72;
ma=0.3;
kn0=0.01;
ha=sqrt(re*rs*rb);
sigmau=0.85;
thu=(2-sigmau)/sigmau;
kn=kn0/P;
p=2;
ma=sqrt(e);
n1=((e*re)/(ga*ma^2*ha^2));
n2=(thu*ha*sinh(ha/2));
n3=(thu^2 * ha^2 * cosh(ha/2));
n4=-cosh(ha/2);
kn=kn0./P;
u=((k-n1*diff(P,x))/((n2*kn)+(n3*kn^2)+n4))*cosh(ha*y)+k-(n1*diff(P,x));
ux=diff(u,x);
n5=(ux+(n1*diff(P, x, x)))/cosh(ha*y);
n6=((k-n1*diff(P,x))/((n2*kn)+(n3*kn^2)+n4));
n7=k-(n1*diff(P,x));
y=0.5;
v=(n1*y*dP)-((n6*sinh(ha*y)*dP)/(ha*P))-((n7*y*dP)/P)-((n5*sinh(ha*y))/ha)+((n6*sinh(ha/2)*dP)/ha*P)+((n7*dP)/(2*P))+((n5*sinh(ha/2))/ha)-((n1*d2P)/2);
[VFv,Subsv] = odeToVectorField(v);
vfun = matlabFunction(VFv, 'Vars',{t,Y})
producing:
vfun =
function_handle with value:
@(t,Y)[Y(2);Y(2)+(sqrt(3.0).*Y(2).^2.*1.92299994911867e2)./(Y(1).*(6.759429983029036e2./Y(1)+1.0./Y(1).^2.*1.58397981106159e2-2.884500097018271e3))-(sqrt(3.0).*Y(1).*Y(2).^2.*1.92299994911867e2)./(6.759429983029036e2./Y(1)+1.0./Y(1).^2.*1.58397981106159e2-2.884500097018271e3)]
or, more conveniently (with a bit of manual editing):
vfun = @(t,Y) [Y(2);Y(2)+(sqrt(3.0).*Y(2).^2.*1.92299994911867e2)./(Y(1).*(6.759429983029036e2./Y(1)+1.0./Y(1).^2.*1.58397981106159e2-2.884500097018271e3))-(sqrt(3.0).*Y(1).*Y(2).^2.*1.92299994911867e2)./(6.759429983029036e2./Y(1)+1.0./Y(1).^2.*1.58397981106159e2-2.884500097018271e3)];
Best Answer